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
@ -812,3 +812,11 @@ pub fn (s string) hash() int {
|
||||
return h
|
||||
}
|
||||
|
||||
pub fn (s string) bytes() []byte {
|
||||
if s.len == 0 {
|
||||
return []byte
|
||||
}
|
||||
mut buf := [byte(0); s.len]
|
||||
C.memcpy(buf.data, s.str, s.len)
|
||||
return buf
|
||||
}
|
||||
|
Reference in New Issue
Block a user