util

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToChaincodeArgs

func ArrayToChaincodeArgs(args []string) [][]byte

func CanonicalizeFilePath

func CanonicalizeFilePath(filepath string) string

func CanonicalizePath

func CanonicalizePath(path string) string

func ComputeCryptoHash

func ComputeCryptoHash(data []byte) (hash []byte)

ComputeCryptoHash should be used in openchain code so that we can change the actual algo used for crypto-hash at one place

func CreateUtcTimestamp

func CreateUtcTimestamp() *timestamp.Timestamp

CreateUtcTimestamp returns a google/protobuf/Timestamp in UTC (DEPRECATED, moved to protos)

func CryptoHashByAlg

func CryptoHashByAlg(alg string) hash.Hash

func DecodeToUint64

func DecodeToUint64(bytes []byte) uint64

func DefaultCryptoHash

func DefaultCryptoHash() hash.Hash

func EncodeStatehash

func EncodeStatehash(statehash []byte) string

func EncodeUint64

func EncodeUint64(number uint64) []byte

func FindMissingElements

func FindMissingElements(all []string, some []string) (delta []string)

FindMissingElements identifies the elements of the first slice that are not present in the second The second slice is expected to be a subset of the first slice

func GenerateBytesUUID

func GenerateBytesUUID() []byte

GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes

func GenerateHashFromSignature

func GenerateHashFromSignature(path string, args []byte) []byte

GenerateHashFromSignature returns a hash of the combined parameters

func GenerateIDWithAlg

func GenerateIDWithAlg(customIDgenAlg string, payload []byte) (string, error)

GenerateIDWithAlg generates an ID using a custom algorithm

func GenerateIDfromDigest

func GenerateIDfromDigest(d []byte) string

GenerateIDfromTxSHAHash generates SHA256 hash using Tx payload

func GenerateIDfromTxSHA256Hash

func GenerateIDfromTxSHA256Hash(payload []byte) string

func GenerateIDfromTxSHAHash deprecated

func GenerateIDfromTxSHAHash(payload []byte) string

Deprecated: GenerateIDfromTxSHAHash generates SHA256 hash using Tx payload

func GenerateIntUUID

func GenerateIntUUID() *big.Int

GenerateIntUUID returns a UUID based on RFC 4122 returning a big.Int

func GenerateUUID

func GenerateUUID() string

GenerateUUID returns a UUID based on RFC 4122

func Min

func Min(v1, v2 uint64) uint64

func MkdirIfNotExist

func MkdirIfNotExist(targetDir string) bool

func ToChaincodeArgs

func ToChaincodeArgs(args ...string) [][]byte

Types

type ConWriter

type ConWriter interface {
	Write([]byte) ConWriter
	Error() error
}

func NewConWriter

func NewConWriter(wr io.Writer) ConWriter

func NewHashWriter

func NewHashWriter(h hash.Hash) ConWriter

Jump to

Keyboard shortcuts

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