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

lower/snake case consts & enums

This commit is contained in:
joe-conigliaro
2019-10-24 22:48:20 +11:00
committed by Alexander Medvednikov
parent fe17dd9a7e
commit 580abe0de4
20 changed files with 301 additions and 308 deletions

View File

@@ -11,10 +11,10 @@ module sha1
import math.bits
const (
_K0 = 0x5A827999
_K1 = 0x6ED9EBA1
_K2 = 0x8F1BBCDC
_K3 = 0xCA62C1D6
_k0 = 0x5A827999
_k1 = 0x6ED9EBA1
_k2 = 0x8F1BBCDC
_k3 = 0xCA62C1D6
)
fn block_generic(dig mut Digest, p_ []byte) {
@@ -25,7 +25,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
mut h2 := dig.h[2]
mut h3 := dig.h[3]
mut h4 := dig.h[4]
for p.len >= Chunk {
for p.len >= chunk {
// Can interlace the computation of w with the
// rounds below if needed for speed.
for i := 0; i < 16; i++ {
@@ -41,11 +41,11 @@ fn block_generic(dig mut Digest, p_ []byte) {
// Each of the four 20-iteration rounds
// differs only in the computation of f and
// the choice of K (_K0, _K1, etc).
// the choice of K (_k0, _k1, etc).
mut i := 0
for i < 16 {
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
d = c
c = bits.rotate_left_32(b, 30)
@@ -57,7 +57,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | u32(tmp>>(32-1))
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
d = c
c = bits.rotate_left_32(b, 30)
@@ -69,7 +69,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | u32(tmp>>(32-1))
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
d = c
c = bits.rotate_left_32(b, 30)
@@ -81,7 +81,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | u32(tmp>>(32-1))
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
d = c
c = bits.rotate_left_32(b, 30)
@@ -93,7 +93,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
w[i&0xf] = tmp<<1 | u32(tmp>>(32-1))
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
d = c
c = bits.rotate_left_32(b, 30)
@@ -108,10 +108,10 @@ fn block_generic(dig mut Digest, p_ []byte) {
h3 += d
h4 += e
if Chunk >= p.len {
if chunk >= p.len {
p = []byte
} else {
p = p.right(Chunk)
p = p.right(chunk)
}
}