示例#1
0
文件: sha512.go 项目: postfix/go-ssl
// New returns a new sha256 hash.Hash
func New() hash.Hash {
	hash := new(SHA512Hash)
	if C.SHA512_Init(&hash.sha) != 1 {
		panic("problem creating hash")
	}
	return hash
}
示例#2
0
文件: sha512.go 项目: runcom/gossl
// New returns a new sha512 hash.Hash
// if the returned hash is empty, then make a call to sslerr.Error()
func New() hash.Hash {
	d := new(digest)
	d.function = crypto.SHA512
	if C.SHA512_Init(&d.ctx) != 1 {
		return nil
	}
	return d
}
示例#3
0
文件: sha512.go 项目: runcom/gossl
func (d *digest) Reset() {
	switch d.function {
	case crypto.SHA384:
		C.SHA384_Init(&d.ctx)
	default:
		C.SHA512_Init(&d.ctx)
	}
}
示例#4
0
文件: sha512.go 项目: postfix/go-ssl
func (self *SHA512Hash) Reset() {
	C.SHA512_Init(&self.sha)
}
示例#5
0
文件: sha.go 项目: eftychis/crypto-1
func (h *sha512) Reset() {
	if C.SHA512_Init(&h.ctx) != 1 {
		panic("SHA512_Init failed") // hash funcs shouldn't fail
	}
}