Пример #1
0
// FingerprintTriple generates a SHA-1 hash of the triple.
func FingerprintTriple(t *protocol.Triple) ([]byte, error) {
	data, err := t.Marshal()
	if err != nil {
		return nil, err
	}
	sum := sha1.Sum(data)
	return sum[:], nil
}
Пример #2
0
// FingerprintTriple generates a SHA-1 hash of the triple.
func FingerprintTriple(t *protocol.Triple) ([]byte, error) {
	h := sha1.New()
	data, err := t.Marshal()
	if err != nil {
		return nil, err
	}
	if _, err := h.Write(data); err != nil {
		return nil, err
	}
	return h.Sum(nil), nil
}