docutil

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 17

Documentation

Index

Constants

View Source
const NamespaceDelimiter = ":"

NamespaceDelimiter is the delimiter that separates the namespace from the unique suffix

Variables

This section is empty.

Functions

func CalculateID

func CalculateID(namespace, encoded string, hashAlgorithmAsMultihashCode uint) (string, error)

CalculateID calculates the ID from an encoded value

func CalculateUniqueSuffix added in v0.1.2

func CalculateUniqueSuffix(encoded string, hashAlgorithmAsMultihashCode uint) (string, error)

CalculateUniqueSuffix calculates the unique suffix from an encoded value

func ComputeMultihash

func ComputeMultihash(multihashCode uint, bytes []byte) ([]byte, error)

ComputeMultihash will compute the hash for the supplied bytes using multihash code

func DecodeString

func DecodeString(encodedContent string) ([]byte, error)

DecodeString decodes the encoded content to Bytes

func EncodeToString

func EncodeToString(data []byte) string

EncodeToString encodes the bytes to string

func GetHash

func GetHash(multihashCode uint) (h hash.Hash, err error)

GetHash will return hash based on specified multihash code

func GetMultihashCode added in v0.1.2

func GetMultihashCode(encodedMultihash string) (uint64, error)

GetMultihashCode returns multihash code from encoded multihash

func IsComputedUsingHashAlgorithm added in v0.1.3

func IsComputedUsingHashAlgorithm(encodedMultihash string, code uint64) bool

IsComputedUsingHashAlgorithm checks to see if the given encoded hash has been hashed using multihash code

func IsSupportedMultihash

func IsSupportedMultihash(encodedMultihash string) bool

IsSupportedMultihash checks to see if the given encoded hash has been hashed using valid multihash code

func MarshalCanonical

func MarshalCanonical(v interface{}) ([]byte, error)

MarshalCanonical marshals the object into a canonical JSON format

func MarshalIndentCanonical

func MarshalIndentCanonical(v interface{}, prefix, indent string) ([]byte, error)

MarshalIndentCanonical is like MarshalCanonical but applies Indent to format the output. Each JSON element in the output will begin on a new line beginning with prefix followed by one or more copies of indent according to the indentation nesting.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL