From 8bd17c8016afe76615c904144777994092d1e5ff Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sun, 2 Feb 2020 12:50:46 +1100 Subject: [PATCH] crypto.rand: update slice method to slice syntax & fix typo in error --- vlib/crypto/rand/rand_linux.v | 2 +- vlib/crypto/rand/utils.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/crypto/rand/rand_linux.v b/vlib/crypto/rand/rand_linux.v index 92e50cf416..15eeff8fed 100644 --- a/vlib/crypto/rand/rand_linux.v +++ b/vlib/crypto/rand/rand_linux.v @@ -34,7 +34,7 @@ pub fn read(bytes_needed int) ?[]byte { fn getrandom(bytes_needed int, buffer voidptr) int { if bytes_needed > read_batch_size { - panic('getrandom() dont request more thane $read_batch_size bytes at once.') + panic('getrandom() dont request more than $read_batch_size bytes at once.') } return C.syscall(C.SYS_getrandom, buffer, bytes_needed, 0) } diff --git a/vlib/crypto/rand/utils.v b/vlib/crypto/rand/utils.v index abeeabe3e2..c0bf11ea1f 100644 --- a/vlib/crypto/rand/utils.v +++ b/vlib/crypto/rand/utils.v @@ -43,7 +43,7 @@ fn bytes_to_u64(b []byte) []u64 { mut z := [u64(0)].repeat((b.len + ws - 1) / ws) mut i := b.len for k := 0; i >= ws; k++ { - z[k] = binary.big_endian_u64(b.slice(i-ws, i)) + z[k] = binary.big_endian_u64(b[i-ws..i]) i -= ws } if i > 0 {