Documentation ¶
Index ¶
- Variables
- func Bytes2Hex(d []byte) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func DoubleHashB(b []byte) []byte
- func EmptyHash(h Hash) bool
- func FromHex(s string) ([]byte, error)
- func GetNtpTime(host string) (time.Time, error)
- func GetRandBytes(min, max int) []byte
- func GetRandPrintString(min, max int) string
- func GetRandString(length int) string
- func GetRealTime(hosts []string) time.Time
- func GetRealTimeRetry(hosts []string, retry int) time.Time
- func HasHexPrefix(str string) bool
- func HashB(b []byte) []byte
- func HashHex(d []byte) string
- func Hex2Bytes(str string) ([]byte, error)
- func IsHex(str string) bool
- func MaxInt32(left, right int32) int32
- func MinInt32(left, right int32) int32
- func RandKey() (ret [32]byte)
- func Rimp160AfterSha256(b []byte) (out [20]byte)
- func Sha256(b []byte) []byte
- func Sha2Sum(b []byte) (out [32]byte)
- func ShaKeccak256(b []byte) []byte
- func ToHex(b []byte) string
- type Hash
- func (h Hash) Bytes() []byte
- func (h Hash) Format(s fmt.State, c rune)
- func (h Hash) Hex() string
- func (h Hash) Revers() Hash
- func (h Hash) ReversString() string
- func (h *Hash) Set(other Hash)
- func (h *Hash) SetBytes(b []byte)
- func (h *Hash) SetString(s string)
- func (h Hash) Str() string
- func (h Hash) String() string
- func (h Hash) TerminalString() string
Constants ¶
This section is empty.
Variables ¶
var ErrNetWorkDealy = errors.New("ErrNetWorkDealy")
Functions ¶
func DoubleHashB ¶
DoubleHashB calculates hash(hash(b)) and returns the resulting bytes.
func GetNtpTime ¶
t2 t3 t6 t7 --------------------------------------------------------- /\ \ /\ \ / \ / \ / \ / \ / \/ / \/ --------------------------------------------------------- t1 t4 t5 t8
利用服务器返回的 t2, t3, 和本地的 t1, t4 校准时间 delt = ((t2-t1)+(t3-t4))/2 current = t4 + delt
func GetRandBytes ¶
func GetRandPrintString ¶
func GetRandString ¶
func GetRealTime ¶
func HasHexPrefix ¶
func Rimp160AfterSha256 ¶
Returns hash: RIMP160( SHA256( data ) ) Where possible, using RimpHash() should be a bit faster
func Sha2Sum ¶
Returns hash: SHA256( SHA256( data ) ) Where possible, using ShaHash() should be a bit faster
func ShaKeccak256 ¶
Types ¶
type Hash ¶
type Hash [hashLength]byte
func BytesToHash ¶
func DoubleHashH ¶
DoubleHashH calculates hash(hash(b)) and returns the resulting bytes as a Hash.
func StringToHash ¶
func (Hash) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Hash) ReversString ¶
String returns the Hash as the hexadecimal string of the byte-reversed hash.
func (*Hash) SetBytes ¶
Sets the hash to the value of b. If b is larger than len(h), 'b' will be cropped (from the left).
func (*Hash) SetString ¶
Set string `s` to h. If s is larger than len(h) s will be cropped (from left) to fit.
func (Hash) String ¶
String implements the stringer interface and is used also by the logger when doing full logging into a file.
func (Hash) TerminalString ¶
TerminalString implements log.TerminalStringer, formatting a string for console output during logging.
Directories ¶
Path | Synopsis |
---|---|
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |
log15
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
|
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable. |
Package pubsub implements a simple multi-topic pub-sub library.
|
Package pubsub implements a simple multi-topic pub-sub library. |