SetBytes sets the bytes which represent the hash. An error is returned if the number of bytes passed in is not HashSize.
(newHash []byte)
| 92 | // SetBytes sets the bytes which represent the hash. An error is returned if |
| 93 | // the number of bytes passed in is not HashSize. |
| 94 | func (h *Hash) SetBytes(newHash []byte) error { |
| 95 | nhlen := len(newHash) |
| 96 | if nhlen != HashSize { |
| 97 | return fmt.Errorf("invalid hash length of %v, want %v", nhlen, |
| 98 | HashSize) |
| 99 | } |
| 100 | copy(h[:], newHash) |
| 101 | |
| 102 | return nil |
| 103 | } |
| 104 | |
| 105 | // IsEqual returns true if target is the same as hash. |
| 106 | func (h *Hash) IsEqual(target *Hash) bool { |