mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
crypto: add utility hexhash functions
This commit is contained in:
parent
bb9eec8696
commit
93716ee944
4 changed files with 20 additions and 8 deletions
|
@ -78,14 +78,14 @@ fn (d mut Digest) reset() {
|
|||
}
|
||||
|
||||
// new returns a new Digest (implementing hash.Hash) computing the SHA256 checksum.
|
||||
pub fn new() *Digest {
|
||||
pub fn new() &Digest {
|
||||
mut d := &Digest{}
|
||||
d.reset()
|
||||
return d
|
||||
}
|
||||
|
||||
// new224 returns a new Digest (implementing hash.Hash) computing the SHA224 checksum.
|
||||
pub fn new224() *Digest {
|
||||
pub fn new224() &Digest {
|
||||
mut d := &Digest{}
|
||||
d.is224 = true
|
||||
d.reset()
|
||||
|
@ -212,3 +212,6 @@ pub fn (d &Digest) size() int {
|
|||
}
|
||||
|
||||
pub fn (d &Digest) block_size() int { return BlockSize }
|
||||
|
||||
pub fn hexhash(s string) string { return sum256(s.bytes()).hex() }
|
||||
pub fn hexhash_224(s string) string { return sum224(s.bytes()).hex() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue