1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: fix sha1 test by fixing << | expressions with explicit parenthesis for now.

This commit is contained in:
Delyan Angelov 2020-04-08 16:30:19 +03:00
parent 80888b9518
commit a8fe3a59b0
2 changed files with 4 additions and 5 deletions

View File

@ -14,7 +14,6 @@ const (
'vlib/crypto/aes/aes_test.v', 'vlib/crypto/aes/aes_test.v',
'vlib/crypto/rand/rand_test.v', 'vlib/crypto/rand/rand_test.v',
'vlib/crypto/rc4/rc4_test.v', 'vlib/crypto/rc4/rc4_test.v',
'vlib/crypto/sha1/sha1_test.v',
'vlib/crypto/sha256/sha256_test.v', 'vlib/crypto/sha256/sha256_test.v',
'vlib/crypto/sha512/sha512_test.v', 'vlib/crypto/sha512/sha512_test.v',
'vlib/encoding/base64/base64_memory_test.v', 'vlib/encoding/base64/base64_memory_test.v',

View File

@ -55,7 +55,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
} }
for i < 20 { for i < 20 {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | (tmp>>(32-1)) w[i&0xf] = (tmp<<1) | (tmp>>(32-1))
f := b&c | (~b)&d f := b&c | (~b)&d
t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k0) t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k0)
e = d e = d
@ -67,7 +67,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
} }
for i < 40 { for i < 40 {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | (tmp>>(32-1)) w[i&0xf] = (tmp<<1) | (tmp>>(32-1))
f := b ^ c ^ d f := b ^ c ^ d
t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k1) t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k1)
e = d e = d
@ -79,7 +79,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
} }
for i < 60 { for i < 60 {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | (tmp>>(32-1)) w[i&0xf] = (tmp<<1) | (tmp>>(32-1))
f := ((b | c) & d) | (b & c) f := ((b | c) & d) | (b & c)
t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k2) t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k2)
e = d e = d
@ -91,7 +91,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
} }
for i < 80 { for i < 80 {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | (tmp>>(32-1)) w[i&0xf] = (tmp<<1) | (tmp>>(32-1))
f := b ^ c ^ d f := b ^ c ^ d
t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k3) t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k3)
e = d e = d