Categorygithub.com/gatechain/crypto
modulepackage
0.1.0
Repository: https://github.com/gatechain/crypto.git
Documentation: pkg.go.dev

# README

Crypto

This repository is the cryptographic package adapted for GateChain's uses.

Download/Install

The easiest way to install is to run go get -u github.com/gatechain/crypto. You can also manually git clone the repository to $GOPATH/src/github.com/gatechain/crypto.

Usage

import "github.com/gatechain/crypto"

This package depends on libsodium. Set the following environment variables before using

export SODIUM_PATH=/usr/local  (The installed libsodium library path, Users modify the installation path according to their own)
export CGO_CFLAGS="-I$SODIUM_PATH/include"
export CGO_LDFLAGS="-L$SODIUM_PATH/lib"

Report Issues

The main issue tracker for the repository is located at https://github.com/gatechain/crypto/issues.

Note that contributions receive additional scrutiny due to their sensitive nature.

# Packages

No description provided by the author
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
nolint: dupl.
Package metrics provides a metric logging wrappers for Prometheus server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
This only uses the OS's randomness.
CRandHex returns a hex encoded string that's floor(numDigits/2) * 2 long.
Returns a crand.Reader.
DigestFromString converts a string to a Digest.
DigestFromString converts a string to a Digest.
Hash computes the SHASum384 hash of an array of bytes.
Hash computes the SHASum512_256 hash of an array of bytes.
HashObj computes a hash of a Hashable object and its type.
HashObj computes a hash of a Hashable object and its type.
No description provided by the author
MakePRNG creates a new PRNG from an initial seed.
MultisigAdd adds unisig to an existing msig.
MultisigAddrGen identifes the exact group, version, and devices (Public keys) that it requires to sign Hash("MultisigAddr" || version uint8 || threshold uint8 || PK1 || PK2 || ...).
MultisigAddrGenWithSubsigs is similiar to MultisigAddrGen except the input is []Subsig rather than []PublicKey.
MultisigAssemble assembles multiple MultisigSig.
MultisigMerge merges two Multisigs msig1 and msig2 into msigt.
MultisigPreimageFromPKs makes an empty MultisigSig for a given preimage.
MultisigSign is for each device individually signs the digest.
MultisigVerify verifies an assembled MultisigSig.
NewHash returns a sha512-384 object to do the same operation as Hash().
NewHash returns a sha512-256 object to do the same operation as Hash().
RandBytes fills the provided structure with a set of random bytes.
RandUint63 returns a random 64-bit unsigned integer which can be stored in a 64-bit signed integer without any data loss.
RandUint64 returns a random 64-bit unsigned integer.
No description provided by the author
Hash computes the SHASum512_256 hash of an array of bytes.

# Constants

AddressSize is the size of a pubkey address.
DigestSize is the number of bytes in the preferred hash Digest used here.
DigestSize is the number of bytes in the preferred hash Digest used here.

# Variables

SystemRNG implements the RNG interface using the system-wide randomness source (from Go's crypto/rand).

# Structs

MultisigSig is the structure that holds multiple Subsigs.
MultisigSubsig is a struct that holds a pair of public key and signatures signatures may be empty.
PRNG is a pseudo-random implementation of RNG, used for deterministic testing.

# Interfaces

Hashable is an interface implemented by an object that can be represented with a sequence of bytes to be hashed or signed, together with a type ID to distinguish different types of objects.
No description provided by the author
No description provided by the author
RNG represents a randomness source.
No description provided by the author

# Type aliases

An address is a []byte, but hex-encoded even in JSON.
Digest represents a 48-byte value holding the 256-bit Hash digest.
Digest512 represents a 64-byte value holding the 512-bit Hash digest.
HashID is a domain separation prefix for an object type that might be hashed This ensures, for example, the hash of a transaction will never collide with the hash of a vote.
SecretKey is casted from SignatureSecrets.