From c3ee4fb2a26143bca07fc720292942af0bef0ba2 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 15 Apr 2022 08:56:01 +0300 Subject: [PATCH] crypto: make public all Digest.checksum() methods --- vlib/crypto/sha1/sha1.v | 4 ++-- vlib/crypto/sha256/sha256.v | 3 ++- vlib/crypto/sha512/sha512.v | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vlib/crypto/sha1/sha1.v b/vlib/crypto/sha1/sha1.v index b7a80f3af0..04678f7822 100644 --- a/vlib/crypto/sha1/sha1.v +++ b/vlib/crypto/sha1/sha1.v @@ -102,8 +102,8 @@ pub fn (d &Digest) sum(b_in []byte) []byte { return b_out } -// checksum returns the byte checksum of the `Digest`. -fn (mut d Digest) checksum() []byte { +// checksum returns the current byte checksum of the `Digest`. +pub fn (mut d Digest) checksum() []byte { mut len := d.len // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. mut tmp := []byte{len: (64)} diff --git a/vlib/crypto/sha256/sha256.v b/vlib/crypto/sha256/sha256.v index 76be52e314..e8bd91833c 100644 --- a/vlib/crypto/sha256/sha256.v +++ b/vlib/crypto/sha256/sha256.v @@ -142,7 +142,8 @@ pub fn (d &Digest) sum(b_in []byte) []byte { return b_out } -fn (mut d Digest) checksum() []byte { +// checksum returns the current byte checksum of the Digest. +pub fn (mut d Digest) checksum() []byte { mut len := d.len // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. mut tmp := []byte{len: (64)} diff --git a/vlib/crypto/sha512/sha512.v b/vlib/crypto/sha512/sha512.v index 6a22ee7d26..6327ab3fe9 100644 --- a/vlib/crypto/sha512/sha512.v +++ b/vlib/crypto/sha512/sha512.v @@ -214,7 +214,8 @@ pub fn (d &Digest) sum(b_in []byte) []byte { return b_out } -fn (mut d Digest) checksum() []byte { +// checksum returns the current byte checksum of the Digest. +pub fn (mut d Digest) checksum() []byte { // Padding. Add a 1 bit and 0 bits until 112 bytes mod 128. mut len := d.len mut tmp := []byte{len: (128)}