From f2c6735d929f8466c4fd0d80b5b0752906eea835 Mon Sep 17 00:00:00 2001 From: Larpon Date: Fri, 22 Jan 2021 14:14:31 +0100 Subject: [PATCH] crypto: make Digest.sum() and Digest.write() private in md5 and sha1 (#8270) --- vlib/crypto/md5/md5.v | 4 ++-- vlib/crypto/sha1/sha1.v | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vlib/crypto/md5/md5.v b/vlib/crypto/md5/md5.v index 2f04bee403..101e446725 100644 --- a/vlib/crypto/md5/md5.v +++ b/vlib/crypto/md5/md5.v @@ -51,7 +51,7 @@ pub fn new() &Digest { return d } -pub fn (mut d Digest) write(p_ []byte) int { +fn (mut d Digest) write(p_ []byte) int { unsafe { mut p := p_ nn := p.len @@ -85,7 +85,7 @@ pub fn (mut d Digest) write(p_ []byte) int { } } -pub fn (d &Digest) sum(b_in []byte) []byte { +fn (d &Digest) sum(b_in []byte) []byte { // Make a copy of d so that caller can keep writing and summing. mut d0 := *d hash := d0.checksum() diff --git a/vlib/crypto/sha1/sha1.v b/vlib/crypto/sha1/sha1.v index 85dcc6f54f..4ce8092779 100644 --- a/vlib/crypto/sha1/sha1.v +++ b/vlib/crypto/sha1/sha1.v @@ -55,7 +55,7 @@ pub fn new() &Digest { } [manualfree] -pub fn (mut d Digest) write(p_ []byte) int { +fn (mut d Digest) write(p_ []byte) int { nn := p_.len unsafe { mut p := p_ @@ -89,7 +89,7 @@ pub fn (mut d Digest) write(p_ []byte) int { return nn } -pub fn (d &Digest) sum(b_in []byte) []byte { +fn (d &Digest) sum(b_in []byte) []byte { // Make a copy of d so that caller can keep writing and summing. mut d0 := *d hash := d0.checksum()