MCPcopy Create free account
hub / github.com/chain/txvm / HashFromBytes

Function HashFromBytes

protocol/bc/hash.go:39–43  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

37// responsible for ensuring the byte slice is of the right length. It
38// will be 0-padded or truncated if it's not.
39func 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,

Callers 9

idTimeFunction · 0.92
TestTxBuilderFunction · 0.92
TestResultsFunction · 0.92
TestProgCreationFunction · 0.92
addOutputMetaFunction · 0.92
addInputMetaFunction · 0.92
TestHashBytesFunction · 0.85
stackHookMethod · 0.85
entryHookMethod · 0.85

Calls 1

NewHashFunction · 0.85

Tested by 4

TestTxBuilderFunction · 0.74
TestResultsFunction · 0.74
TestProgCreationFunction · 0.74
TestHashBytesFunction · 0.68