crypto: make Digest.sum() and Digest.write() private in md5 and sha1 (#8270)
parent
500ebf77e4
commit
f2c6735d92
|
@ -51,7 +51,7 @@ pub fn new() &Digest {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut d Digest) write(p_ []byte) int {
|
fn (mut d Digest) write(p_ []byte) int {
|
||||||
unsafe {
|
unsafe {
|
||||||
mut p := p_
|
mut p := p_
|
||||||
nn := p.len
|
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.
|
// 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()
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub fn new() &Digest {
|
||||||
}
|
}
|
||||||
|
|
||||||
[manualfree]
|
[manualfree]
|
||||||
pub fn (mut d Digest) write(p_ []byte) int {
|
fn (mut d Digest) write(p_ []byte) int {
|
||||||
nn := p_.len
|
nn := p_.len
|
||||||
unsafe {
|
unsafe {
|
||||||
mut p := p_
|
mut p := p_
|
||||||
|
@ -89,7 +89,7 @@ pub fn (mut d Digest) write(p_ []byte) int {
|
||||||
return nn
|
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.
|
// 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…
Reference in New Issue