diff --git a/vlib/bignum/bignum.v b/vlib/bignum/bignum.v index 060fc642cb..da71a02125 100644 --- a/vlib/bignum/bignum.v +++ b/vlib/bignum/bignum.v @@ -126,7 +126,7 @@ pub fn cmp(a Number, b Number) int { return C.bignum_cmp(&a,&b) } pub fn (a Number) is_zero() bool { - return int(C.bignum_is_zero(&a)) != 0 + return C.bignum_is_zero(&a) != 0 } pub fn (a mut Number) inc() { C.bignum_inc(a) diff --git a/vlib/crypto/sha512/sha512.v b/vlib/crypto/sha512/sha512.v index 1278d564ef..5bcaa0fc92 100644 --- a/vlib/crypto/sha512/sha512.v +++ b/vlib/crypto/sha512/sha512.v @@ -27,7 +27,7 @@ pub const ( ) const ( - Chunk = 128 + chunk = 128 init0 = 0x6a09e667f3bcc908 init1 = 0xbb67ae8584caa73b init2 = 0x3c6ef372fe94f82b @@ -73,7 +73,7 @@ mut: fn (d mut Digest) reset() { d.h = [u64(0)].repeat(8) - d.x = [byte(0)].repeat(Chunk) + d.x = [byte(0)].repeat(chunk) match d.function { .sha384 { d.h[0] = init0_384 @@ -155,7 +155,7 @@ fn (d mut Digest) write(p_ []byte) int { if d.nx > 0 { n := copy(d.x[d.nx..], p) d.nx += n - if d.nx == Chunk { + if d.nx == chunk{ block(mut d, d.x) d.nx = 0 } @@ -166,8 +166,8 @@ fn (d mut Digest) write(p_ []byte) int { p = p[n..] } } - if p.len >= Chunk { - n := p.len & ~(Chunk - 1) + if p.len >= chunk{ + n := p.len & ~(chunk- 1) block(mut d, p[..n]) if n >= p.len { p = [] diff --git a/vlib/crypto/sha512/sha512block_generic.v b/vlib/crypto/sha512/sha512block_generic.v index b28cc9e222..134442be30 100644 --- a/vlib/crypto/sha512/sha512block_generic.v +++ b/vlib/crypto/sha512/sha512block_generic.v @@ -104,7 +104,7 @@ fn block_generic(dig mut Digest, p_ []byte) { mut h5 := dig.h[5] mut h6 := dig.h[6] mut h7 := dig.h[7] - for p.len >= Chunk { + for p.len >= chunk { for i in 0..16 { j := i * 8 w[i] = (u64(p[j])<<56) | (u64(p[j + 1])<<48) | (u64(p[j + 2])<<40) | (u64(p[j + 3])<<32) | (u64(p[j + 4])<<24) | (u64(p[j + 5])<<16) | (u64(p[j + 6])<<8) | u64(p[j + 7]) @@ -144,11 +144,11 @@ fn block_generic(dig mut Digest, p_ []byte) { h5 += f h6 += g h7 += h - if Chunk >= p.len { + if chunk >= p.len { p = [] } else { - p = p[Chunk..] + p = p[chunk..] } } dig.h[0] = h0