Exemple #1
0
func (d *digest) Write(buf []byte) (int, error) {
	if len(buf) > 0 {
		C.blake2b_update(&d.state, (*C.uint8_t)(&buf[0]), C.uint64_t(len(buf)))
	}
	return len(buf), nil
}
Exemple #2
0
// Write bytes to update hash state.
func (s *Blake2bState) Write(p []byte) (n int, err error) {
	l := len(p)
	C.blake2b_update(&s.s, (*C.uint8_t)(unsafe.Pointer(&p[0])),
		C.uint64_t(l))
	return l, nil
}