Documentation ¶
Index ¶
- func AppendAll(content ...[]byte) []byte
- func ArraytoString(data []string) string
- func AssertContains(t testing.TB, slice interface{}, value interface{})
- func AssertContainsAll(t testing.TB, sliceActual interface{}, sliceExpected interface{})
- func AssertEquals(t testing.TB, actual interface{}, expected interface{})
- func AssertError(t testing.TB, err error, message string)
- func AssertNil(t testing.TB, value interface{})
- func AssertNoError(t testing.TB, err error, message string)
- func AssertNotEquals(t testing.TB, actual interface{}, expected interface{})
- func AssertNotNil(t testing.TB, value interface{})
- func AssertPanic(t testing.TB, msg string)
- func AssertSame(t testing.TB, actual interface{}, expected interface{})
- func BoolToPtr(b bool) *bool
- func CalculateBCHash(txData []byte) [32]byte
- func CleanEnvVar(s string, r byte) string
- func ComputeBitcoinAddress(pk []byte) string
- func ComputeCryptoHash(data []byte) (hash []byte)
- func ComputeSha256(data string) string
- func ConstructRandomBytes(t testing.TB, size int) []byte
- func CopyFile(src, dst string) (err error)
- func CopyMapStringFloat64(m map[string]float64) map[string]float64
- func CopyMapStringInt(m map[string]int) map[string]int
- func CopyMapStringString(m map[string]string) map[string]string
- func CopySliceInt(s []int) []int
- func CopySliceString(s []string) []string
- func CreateUtcTimestamp() *gp.Timestamp
- func CreateUtcToday() string
- func DecodeBase58(in string) []byte
- func DecodeBase64(in string) ([]byte, error)
- func Decrypt(key []byte, cryptoText string) string
- func EncodeBase58(in []byte) string
- func EncodeBase64(in []byte) string
- func Encrypt(key []byte, text string) string
- func EncryptPassword(pass string) string
- func FindMissingElements(all []string, some []string) (delta []string)
- func GenerateBytesUUID() []byte
- func GenerateHashFromSignature(path string, ctor string, args []string) []byte
- func GenerateIDWithAlg(customIDgenAlg string, encodedPayload string) (string, error)
- func GenerateIntUUID() *big.Int
- func GenerateShortID() string
- func GenerateUUID() string
- func GenerateUUIDfromTxSHAHash(txData []byte) string
- func GetFQDN() string
- func Int2Str(i, length int) (result string)
- func IntArrayEquals(a []int, b []int) bool
- func IntToPtr(i int) *int
- func IsHexdigest(data, digestType string) (valid bool, err error)
- func IsUUID(str string) bool
- func MapStringStringSliceValueSet(m map[string][]string) []string
- func ParseTestParams() []string
- func RandNewStr(len int) string
- func RawDecrypt(key []byte, cryptoText string) string
- func RawEncrypt(key []byte, text string) string
- func RemoveStringSliceDuplicate(haystack []string, isSensitive bool) []string
- func SliceSetDisjoint(first, second []string) (bool, []string)
- func SliceStringIsSubset(larger, smaller []string) (bool, []string)
- func SliceStringToSet(s []string) map[string]struct{}
- func StringInSlice(a string, list []string) bool
- func StringSliceHas(haystack []string, needle string) bool
- func StringSliceHasI(haystack []string, needle string) bool
- func StringToPtr(str string) *string
- func TimeToPtr(t time.Duration) *time.Duration
- func Uint64ToPtr(u uint64) *uint64
- func ValidateBase64EncodingString(encodingString string) bool
- func ValidateTXID(txid string) bool
- func ValidateUUID(uuid string) bool
- func VerifyPassword(pass, hash string) bool
- type TestRandomNumberGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArraytoString ¶
func AssertContains ¶
func AssertContainsAll ¶
func AssertEquals ¶
func AssertNotEquals ¶
func AssertNotNil ¶
func AssertPanic ¶
func AssertSame ¶
func CalculateBCHash ¶
CalculateBCHash returns the Bitcoin hash (double sha256) of the given transaction
func CleanEnvVar ¶
CleanEnvVar replaces all occurrences of illegal characters in an environment variable with the specified byte.
func ComputeBitcoinAddress ¶
ComputeBitcoinAddress compute address from public key Key hash = RIPEMD-160(SHA-256(public key)) Checksum = SHA-256(SHA-256(Key hash)) first 4 bytes Bitcoin Address = Base58Encode(Key hash + Checksum)
func ComputeCryptoHash ¶
ComputeCryptoHash should be used in openchain code so that we can change the actual algo used for crypto-hash at one place
func ComputeSha256 ¶
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.
func CopyMapStringString ¶
Helpers for copying generic structures.
func CopySliceInt ¶
func CopySliceString ¶
func CreateUtcTimestamp ¶
CreateUtcTimestamp returns a google/protobuf/Timestamp in UTC
func CreateUtcToday ¶
func CreateUtcToday() string
CreateUtcToday return current utc date, format is: "%d-%02d-%02d"
func EncryptPassword ¶
EncryptPassword encrypt password and return hash result you can not decrypt this password any more
func FindMissingElements ¶
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 ¶
GenerateHashFromSignature returns a hash of the combined parameters
func GenerateIDWithAlg ¶
GenerateIDWithAlg generates an ID using a custom algorithm
func GenerateIntUUID ¶
GenerateIntUUID returns a UUID based on RFC 4122 returning a big.Int
func GenerateShortID ¶
func GenerateShortID() string
GenerateShortID generates a short id (length = 9)
func GenerateUUIDfromTxSHAHash ¶
GenerateUUIDfromTxSHAHash generates SHA256 hash using Tx payload, and uses its first 128 bits as a UUID
func GetFQDN ¶
func GetFQDN() string
GetFQDN Fully Qualified Domain Name returns "unknown" or hostanme in case of error
func IntArrayEquals ¶
IntArrayEquals checks if the arrays of ints are the same
func IsHexdigest ¶
Check if the data is valid SHA1, MD5 or SHA256 string.
func MapStringStringSliceValueSet ¶
MapStringStringSliceValueSet returns the set of values in a map[string][]string
func ParseTestParams ¶
func ParseTestParams() []string
func RandNewStr ¶
func RawDecrypt ¶
Decrypt from base64 RawURLEncoding to decrypted string
func RawEncrypt ¶
Encrypt string to base64 RawURLEncoding crypto using AES
func RemoveStringSliceDuplicate ¶
RemoveDuplicate remove duplicates for haystack(isSensitive true for case-sensitive, false for case-insensitive)
func SliceSetDisjoint ¶
func SliceStringIsSubset ¶
SliceStringIsSubset returns whether the smaller set of strings is a subset of the larger. If the smaller slice is not a subset, the offending elements are returned.
func SliceStringToSet ¶
func StringInSlice ¶
func StringSliceHas ¶
Has returns true if the needle is in the haystack (case-sensitive)
func StringSliceHasI ¶
HasI returns true if the needle is in the haystack (case-insensitive)
func ValidateBase64EncodingString ¶
validate base64 encoding string
func VerifyPassword ¶
VerifyPassword verify the pass is match with the given hash
Types ¶
type TestRandomNumberGenerator ¶
type TestRandomNumberGenerator struct {
// contains filtered or unexported fields
}
func NewTestRandomNumberGenerator ¶
func NewTestRandomNumberGenerator(maxNumber int) *TestRandomNumberGenerator
func (*TestRandomNumberGenerator) Next ¶
func (randNumGenerator *TestRandomNumberGenerator) Next() int