library: crypto/{sha1, sha256, sha512}
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package sha512
|
||||
|
||||
import (
|
||||
"hash"
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/c"
|
||||
@@ -29,3 +30,14 @@ func (d *digest384) Sum(in []byte) []byte {
|
||||
d.ctx.Final((*byte)(unsafe.Pointer(hash)))
|
||||
return append(in, hash[:]...)
|
||||
}
|
||||
|
||||
func New384() hash.Hash {
|
||||
d := new(digest384)
|
||||
d.ctx.Init()
|
||||
return d
|
||||
}
|
||||
|
||||
func Sum384(data []byte) (ret [Size384]byte) {
|
||||
openssl.SHA384Bytes(data, &ret[0])
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user