MCPcopy Create free account
hub / github.com/emvi/hide / FromString

Function FromString

util.go:4–6  ·  view source on GitHub ↗

FromString returns a new ID from given hash by using the hasher or an error if it couldn't decode the hash.

(id string)

Source from the content-addressed store, hash-verified

2
3// FromString returns a new ID from given hash by using the hasher or an error if it couldn't decode the hash.
4func FromString(id string) (ID, error) {
5 return hash.Decode([]byte(id))
6}
7
8// ToString returns a new hash from given ID by using the hasher or an error if it couldn't encode the ID.
9// If ID is 0, "null" will be returned.

Callers 2

TestFromStringFunction · 0.85
TestFromStringEmptyFunction · 0.85

Calls 1

DecodeMethod · 0.65

Tested by 2

TestFromStringFunction · 0.68
TestFromStringEmptyFunction · 0.68