1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

crypto: add utility hexhash functions

This commit is contained in:
Delyan Angelov
2019-09-02 20:22:19 +03:00
committed by Alexander Medvednikov
parent bb9eec8696
commit 93716ee944
4 changed files with 20 additions and 8 deletions

View File

@@ -49,7 +49,7 @@ fn (d mut Digest) reset() {
}
// new returns a new Digest (implementing hash.Hash) computing the MD5 checksum.
pub fn new() *Digest {
pub fn new() &Digest {
mut d := &Digest{}
d.reset()
return d
@@ -141,3 +141,5 @@ fn block(dig mut Digest, p []byte) {
pub fn (d &Digest) size() int { return Size }
pub fn (d &Digest) block_size() int { return BlockSize }
pub fn hexhash(s string) string { return sum(s.bytes()).hex() }