NewHash returns a new Hash from a byte slice. An error is returned if the number of bytes passed in is not HashSize.
(newHash []byte)
| 172 | // NewHash returns a new Hash from a byte slice. An error is returned if |
| 173 | // the number of bytes passed in is not HashSize. |
| 174 | func NewHash(newHash []byte) (*Hash, error) { |
| 175 | var sh Hash |
| 176 | err := sh.SetBytes(newHash) |
| 177 | if err != nil { |
| 178 | return nil, err |
| 179 | } |
| 180 | return &sh, err |
| 181 | } |
| 182 | |
| 183 | // NewHashFromStr creates a Hash from a hash string. The string should be |
| 184 | // the hexadecimal string of a byte-reversed hash, but any missing characters |