twofactor/vendor/github.com/sec51/convert/common.go
silenteh 72a472700b Addressed issue #1 - Byte order was the problem
The counter needs to be represented in bigendian format.
Unfortunately with commit #00045cb I made the unfortunate choice to swap the endiannes from big-endian to little-endian.
This broke the functionality for certain counters.

- [x] Added Go vendoring
- [x] Bumped version of golang in travis yml file
- [x] Removed conversion files and instead used import of convert sec51 external library
2016-04-24 22:24:31 +02:00

14 lines
222 B
Go

package convert
import (
"math"
)
// Helper function which rounds the float to the nearest integet
func Round(n float64) uint64 {
if n < 0 {
return uint64(math.Ceil(n - 0.5))
}
return uint64(math.Floor(n + 0.5))
}