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 |
---|---|
address | Package address 计算地址相关的函数 |
crypto | Package crypto 加解密、签名接口定义 |
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. |
db | Package db 数据库操作底层接口定义以及实现包括:leveldb、 memdb、mvcc、badgerdb、pegasus、ssdb |
db/mocks | |
db/table | Package table 实现一个基于kv的关系型数据库的表格功能 |
db/table/proto | |
difficulty | Package difficulty 难度计算基础函数 |
limits | Package limits 实现设置进程打开文件资源数 |
listmap | |
log | Package log 日志相关接口以及函数 |
log/log15 | Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable. |
log/log15/term | |
merkle | Package merkle 实现默克尔树相关的hash计算 |
pubsub | Package pubsub implements a simple multi-topic pub-sub library. |
skiplist | |
utils | |
version | Package version 软件版本号 |
vrf | Package vrf defines the interface to a verifiable random function. |
vrf/secp256k1 | Package secp256k1 implements a verifiable random function using curve secp256k1. |