HashFromBytes creates a new Hash from a byte slice. The caller is responsible for ensuring the byte slice is of the right length. It will be 0-padded or truncated if it's not.
(b []byte)
| 37 | // responsible for ensuring the byte slice is of the right length. It |
| 38 | // will be 0-padded or truncated if it's not. |
| 39 | func HashFromBytes(b []byte) Hash { |
| 40 | var b32 [32]byte |
| 41 | copy(b32[:], b) |
| 42 | return NewHash(b32) |
| 43 | } |
| 44 | |
| 45 | // MarshalText satisfies the TextMarshaler interface. |
| 46 | // It returns the bytes of h encoded in hex, |