Documentation ¶
Overview ¶
Package common contains various helper functions.
Index ¶
- Constants
- Variables
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FromHex(s string) ([]byte, error)
- func GetNtpTime(host string) (time.Time, error)
- func GetPointer(id int64) (interface{}, 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 HashHex(d []byte) string
- func IsHex(str string) bool
- func MaxInt32(left, right int32) int32
- func MinInt32(left, right int32) int32
- func RemovePointer(id int64)
- func Rimp160(b []byte) []byte
- func Sha256(b []byte) []byte
- func Sha2Sum(b []byte) []byte
- func Sha3(b []byte) []byte
- func StorePointer(p interface{}) int64
- func ToHex(b []byte) string
- type Hash
Constants ¶
View Source
const Sha256Len = 32
Sha256Len sha256 bytes len
Variables ¶
View Source
var ErrNetWorkDealy = errors.New("ErrNetWorkDealy")
ErrNetWorkDealy error
View Source
var ErrPointerNotFound = errors.New("ErrPointerNotFound")
ErrPointerNotFound 指针没有找到
Functions ¶
func GetNtpTime ¶
GetNtpTime 利用服务器返回的 t2, t3, 和本地的 t1, t4 校准时间 delt = ((t2-t1)+(t3-t4))/2 current = t4 + delt
func GetRandPrintString ¶
GetRandPrintString 获取随机可打印字符串
func GetRealTimeRetry ¶
GetRealTimeRetry 重试获取实际时间
func Rimp160 ¶
Rimp160 Returns hash: RIMP160( SHA256( data ) ) Where possible, using RimpHash() should be a bit faster
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package address 计算地址相关的函数
|
Package address 计算地址相关的函数 |
Package crypto 加解密、签名接口定义
|
Package crypto 加解密、签名接口定义 |
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 db 数据库操作底层接口定义以及实现包括:leveldb、 memdb、mvcc、badgerdb、pegasus、ssdb
|
Package db 数据库操作底层接口定义以及实现包括:leveldb、 memdb、mvcc、badgerdb、pegasus、ssdb |
table
Package table 实现一个基于kv的关系型数据库的表格功能
|
Package table 实现一个基于kv的关系型数据库的表格功能 |
Package difficulty 难度计算基础函数
|
Package difficulty 难度计算基础函数 |
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. |
Package limits 实现设置进程打开文件资源数
|
Package limits 实现设置进程打开文件资源数 |
Package log 日志相关接口以及函数
|
Package log 日志相关接口以及函数 |
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 merkle 实现默克尔树相关的hash计算
|
Package merkle 实现默克尔树相关的hash计算 |
Package pubsub implements a simple multi-topic pub-sub library.
|
Package pubsub implements a simple multi-topic pub-sub library. |
Package version 软件版本号
|
Package version 软件版本号 |
Package vrf defines the interface to a verifiable random function.
|
Package vrf defines the interface to a verifiable random function. |
secp256k1
Package secp256k1 implements a verifiable random function using curve secp256k1.
|
Package secp256k1 implements a verifiable random function using curve secp256k1. |
Click to show internal directories.
Click to hide internal directories.