mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sha1 implementation + helper funcs
This commit is contained in:

committed by
Alexander Medvednikov

parent
37aff9b107
commit
a7529b7b05
@ -225,3 +225,11 @@ fn free(a voidptr) {
|
||||
C.free(a)
|
||||
}
|
||||
|
||||
pub fn (b []byte) hex() string {
|
||||
mut hex := malloc(b.len*2+1)
|
||||
mut ptr := &hex[0]
|
||||
for i := 0; i < b.len ; i++ {
|
||||
ptr += C.sprintf(ptr, '%02X', b[i])
|
||||
}
|
||||
return string(hex)
|
||||
}
|
||||
|
Reference in New Issue
Block a user