diff options
author | EuAndreh <eu@euandre.org> | 2024-08-06 11:00:32 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-08-06 11:00:32 -0300 |
commit | 8dc3d5485c8de6d0398d5df5a6fc4682687f4c9b (patch) | |
tree | db20c1e3982d2077ca08e1a7777b353fc675af98 /src/gobang.go | |
parent | Makefile: Separate dependencies and definition of $(tests.bin-check) (diff) | |
download | gobang-8dc3d5485c8de6d0398d5df5a6fc4682687f4c9b.tar.gz gobang-8dc3d5485c8de6d0398d5df5a6fc4682687f4c9b.tar.xz |
tests/gobang.go: Add tests for Random(), Salt() and Hash()
Diffstat (limited to 'src/gobang.go')
-rw-r--r-- | src/gobang.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gobang.go b/src/gobang.go index dc0d9bc..ff8f68b 100644 --- a/src/gobang.go +++ b/src/gobang.go @@ -57,6 +57,7 @@ type CopyResult struct { const maxInt = int((^uint(0)) >> 1) +const MinimumPasswordLength = 16 const ( scrypt_N = 1 << 15 @@ -410,6 +411,7 @@ func Hash(password []byte, salt []byte) []byte{ } // FIXME: finish rewriting +// FIXME: add tests // // getV7Time returns the time in milliseconds and nanoseconds / 256. // The returned (milli << (12 + seq)) is guaranteed to be greater than @@ -419,8 +421,8 @@ func getV7Time(nano int64) (int64, int64) { const nanoPerMilli = 1000 * 1000 milli := nano / nanoPerMilli - seq := (nano - (milli * nanoPerMilli)) >> 8 - now := milli << (12 + seq) + seq := (nano - (milli * nanoPerMilli)) >> 8 + now := milli << (12 + seq) timeMutex.Lock() defer timeMutex.Unlock() |