diff options
author | EuAndreh <eu@euandre.org> | 2024-07-17 11:45:31 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-07-17 11:45:31 -0300 |
commit | 5193809342c63078dc17bb142ad50beae34b9331 (patch) | |
tree | 978daaaaf38c2afabae201d0a40d2a6cb0da9f0f | |
parent | src/lib.go, tests/lib_test.go: Tweak indentation (diff) | |
download | papod-5193809342c63078dc17bb142ad50beae34b9331.tar.gz papod-5193809342c63078dc17bb142ad50beae34b9331.tar.xz |
src/lib.go, tests/lib_test.go: Normaline function argument declarations
-rw-r--r-- | src/lib.go | 19 | ||||
-rw-r--r-- | tests/lib_test.go | 6 |
2 files changed, 16 insertions, 9 deletions
@@ -417,12 +417,12 @@ func PBKDF2Key( const maxInt = int(^uint(0) >> 1) // blockCopy copies n numbers from src into dst. -func blockCopy(dst, src []uint32, n int) { +func blockCopy(dst []uint32, src []uint32, n int) { copy(dst, src[:n]) } // blockXOR XORs numbers from dst with n numbers from src. -func blockXOR(dst, src []uint32, n int) { +func blockXOR(dst []uint32, src []uint32, n int) { for i, v := range src[:n] { dst[i] ^= v } @@ -430,7 +430,7 @@ func blockXOR(dst, src []uint32, n int) { // salsaXOR applies Salsa20/8 to the XOR of 16 numbers from tmp and in, // and puts the result into both tmp and out. -func salsaXOR(tmp *[16]uint32, in, out []uint32) { +func salsaXOR(tmp *[16]uint32, in []uint32, out []uint32) { w0 := tmp[0] ^ in[0] w1 := tmp[1] ^ in[1] w2 := tmp[2] ^ in[2] @@ -542,7 +542,7 @@ func salsaXOR(tmp *[16]uint32, in, out []uint32) { out[15], tmp[15] = x15, x15 } -func blockMix(tmp *[16]uint32, in, out []uint32, r int) { +func blockMix(tmp *[16]uint32, in []uint32, out []uint32, r int) { blockCopy(tmp[:], in[(2*r-1)*16:], 16) for i := 0; i < 2*r; i += 2 { salsaXOR(tmp, in[i*16:], out[i*8:]) @@ -555,7 +555,7 @@ func integer(b []uint32, r int) uint64 { return uint64(b[j]) | uint64(b[j+1])<<32 } -func smix(b []byte, r, N int, v, xy []uint32) { +func smix(b []byte, r int, N int, v []uint32, xy []uint32) { var tmp [16]uint32 R := 32 * r x := xy @@ -605,7 +605,14 @@ func smix(b []byte, r, N int, v, xy []uint32) { // and p=1. The parameters N, r, and p should be increased as memory latency and // CPU parallelism increases; consider setting N to the highest power of 2 you // can derive within 100 milliseconds. Remember to get a good random salt. -func Scrypt(password, salt []byte, N, r, p, keyLen int) ([]byte, error) { +func Scrypt( + password []byte, + salt []byte, + N int, + r int, + p int, + keyLen int, +) ([]byte, error) { if N <= 1 || N&(N-1) != 0 { return nil, errors.New("scrypt: N must be > 1 and a power of 2") } diff --git a/tests/lib_test.go b/tests/lib_test.go index 2e872ec..5ca6fce 100644 --- a/tests/lib_test.go +++ b/tests/lib_test.go @@ -65,8 +65,6 @@ func TestSetLoggerOutput(t *testing.T) { err := json.Unmarshal([]byte(s), &e) if err != nil { t.Fail() - // gobang.Mmain() - // gobang.Main() } if e.msg != "the message" { t.Fail() @@ -233,7 +231,9 @@ func TestWithHMACSHA256(t *testing.T) { type scryptTestVector struct { password string salt string - N, r, p int + N int + r int + p int output []byte } |