util

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSHA3256

func ComputeSHA3256(data []byte) []byte

ComputeSHA3256 returns SHA3-256 on data

func GetRandomIndices

func GetRandomIndices(indiceCount, highestIndex int) []int

GetRandomIndices returns a slice of random indices from 0 to given highestIndex

func GetX509CertificateFromPEM

func GetX509CertificateFromPEM(cert []byte) (*x509.Certificate, error)

GetX509CertificateFromPEM get on x509 certificate from bytes in PEM format

func IndexInSlice

func IndexInSlice(array interface{}, o interface{}, equals Equals) int

IndexInSlice returns the index of given object o in array

func IsLowS

func IsLowS(k *ecdsa.PublicKey, s *big.Int) (bool, error)

IsLowS ...

func ListSubdirs

func ListSubdirs(dirPath string) ([]string, error)

ListSubdirs returns the subdirectories

func MakeFileAbs

func MakeFileAbs(file, dir string) (string, error)

MakeFileAbs makes 'file' absolute relative to 'dir' if not already absolute

func MarshalECDSASignature

func MarshalECDSASignature(r, s *big.Int) ([]byte, error)

MarshalECDSASignature ...

func PEMToX509Certs

func PEMToX509Certs(pemCert []byte) ([]*x509.Certificate, []string, error)

PEMToX509Certs parse PEM-encoded certs

func RandomInt

func RandomInt(n int) int

RandomInt returns, as an int, a non-negative pseudo-random integer in [0,n) It panics if n <= 0

func RandomUInt64

func RandomUInt64() uint64

RandomUInt64 returns a random uint64

func SignatureToLowS

func SignatureToLowS(k *ecdsa.PublicKey, signature []byte) ([]byte, error)

SignatureToLowS ...

func ToLowS

func ToLowS(k *ecdsa.PublicKey, s *big.Int) (*big.Int, bool, error)

ToLowS ...

func UnmarshalECDSASignature

func UnmarshalECDSASignature(raw []byte) (*big.Int, *big.Int, error)

UnmarshalECDSASignature ...

Types

type ECDSASignature

type ECDSASignature struct {
	R, S *big.Int
}

ECDSASignature ...

type Equals

type Equals func(a interface{}, b interface{}) bool

Equals returns whether a and b are the same

Jump to

Keyboard shortcuts

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