You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
432 B
Go

package blake2
import (
// Standard Extended
"golang.org/x/crypto/blake2b"
)
// Hash
func (algorithm Algorithm) Hash(data []byte) ([]byte, error) {
// Hasher
hasher, err := blake2b.New(algorithm.size, nil)
// Handle Error
if err != nil {
return []byte(""), err
}
// Write To Hasher
_, err = hasher.Write(data)
// Handle Error
if err != nil {
return []byte(""), err
}
// Return Hash
return hasher.Sum(nil), err
}