fabric: github.com/hyperledger/fabric/common/util Index | Files

package util

import "github.com/hyperledger/fabric/common/util"

Index

Package Files

net.go utils.go

Constants

const DELIMITER = "."

func ArrayToChaincodeArgs Uses

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

ArrayToChaincodeArgs converts array of string args to array of []byte args

func ComputeSHA256 Uses

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

ComputeSHA256 returns SHA2-256 on data

func ComputeSHA3256 Uses

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

ComputeSHA3256 returns SHA3-256 on data

func ConcatenateBytes Uses

func ConcatenateBytes(data ...[]byte) []byte

ConcatenateBytes is useful for combining multiple arrays of bytes, especially for signatures or digests over multiple fields

func CreateUtcTimestamp Uses

func CreateUtcTimestamp() *timestamp.Timestamp

CreateUtcTimestamp returns a google/protobuf/Timestamp in UTC

func ExtractRemoteAddress Uses

func ExtractRemoteAddress(ctx context.Context) string

func FindMissingElements Uses

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 Flatten Uses

func Flatten(i interface{}) []string

`flatten` recursively retrieves every leaf node in a struct in depth-first fashion and aggregate the results into given string slice with format: "path.to.leaf = value" in the order of definition. Root name is ignored in the path. This helper function is useful to pretty-print a struct, such as configs. for example, given data structure: A{

B{
  C: "foo",
  D: 42,
},
E: nil,

} it should yield a slice of string containing following items: [

"B.C = \"foo\"",
"B.D = 42",
"E =",

]

func GenerateBytesUUID Uses

func GenerateBytesUUID() []byte

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

func GenerateHashFromSignature Uses

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

GenerateHashFromSignature returns a hash of the combined parameters

func GenerateIDWithAlg Uses

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

GenerateIDWithAlg generates an ID using a custom algorithm

func GenerateIDfromTxSHAHash Uses

func GenerateIDfromTxSHAHash(payload []byte) string

GenerateIDfromTxSHAHash generates SHA256 hash using Tx payload

func GenerateIntUUID Uses

func GenerateIntUUID() *big.Int

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

func GenerateUUID Uses

func GenerateUUID() string

GenerateUUID returns a UUID based on RFC 4122

func GetSysCCVersion Uses

func GetSysCCVersion() string

GetSysCCVersion returns the version of all system chaincodes This needs to be revisited on policies around system chaincode "upgrades" from user and relationship with "fabric" upgrade. For now keep it simple and use the fabric's version stamp

func GetTestChainID Uses

func GetTestChainID() string

GetTestChainID returns the CHAINID constant in use by orderer

func GetTestOrgID Uses

func GetTestOrgID() string

GetTestOrgID returns the ORGID constant in use by gossip join message

func ToChaincodeArgs Uses

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

ToChaincodeArgs converts string args to []byte args

Package util imports 13 packages (graph) and is imported by 151 packages. Updated 2019-06-02. Refresh now. Tools for package owners.