mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
crypto.sha512, crypto.sha256 : Make public the write()
and sum()
methods (#13461)
This commit is contained in:
parent
74048e2f17
commit
57e850e932
2 changed files with 4 additions and 3 deletions
|
@ -90,7 +90,7 @@ pub fn new224() &Digest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write writes the contents of `p_` to the internal hash representation.
|
// write writes the contents of `p_` to the internal hash representation.
|
||||||
fn (mut d Digest) write(p_ []byte) ?int {
|
pub fn (mut d Digest) write(p_ []byte) ?int {
|
||||||
unsafe {
|
unsafe {
|
||||||
mut p := p_
|
mut p := p_
|
||||||
nn := p.len
|
nn := p.len
|
||||||
|
|
|
@ -149,7 +149,7 @@ fn new384() &Digest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write writes the contents of `p_` to the internal hash representation.
|
// write writes the contents of `p_` to the internal hash representation.
|
||||||
fn (mut d Digest) write(p_ []byte) ?int {
|
pub fn (mut d Digest) write(p_ []byte) ?int {
|
||||||
unsafe {
|
unsafe {
|
||||||
mut p := p_
|
mut p := p_
|
||||||
nn := p.len
|
nn := p.len
|
||||||
|
@ -183,7 +183,8 @@ fn (mut d Digest) write(p_ []byte) ?int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (d &Digest) sum(b_in []byte) []byte {
|
// sum returns the SHA512 or SHA384 checksum of digest with the data bytes in `b_in`
|
||||||
|
pub fn (d &Digest) sum(b_in []byte) []byte {
|
||||||
// Make a copy of d so that caller can keep writing and summing.
|
// Make a copy of d so that caller can keep writing and summing.
|
||||||
mut d0 := *d
|
mut d0 := *d
|
||||||
hash := d0.checksum()
|
hash := d0.checksum()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue