crypto

package
v0.0.0-...-4dd0036 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKeyBySeed

func BuildKeyBySeed(seed *[]byte, salt []byte) (*[]byte, *[]byte, error)

通过种子生成key和chainCode

func CheckPukAddr

func CheckPukAddr(pre string, pubKey []byte, addr AddressCoin) bool

检查公钥生成的地址是否一样 @return bool 是否一样 true=相同;false=不相同;

func DecryptCBC

func DecryptCBC(ciphertext, key, iv []byte) ([]byte, error)

解密

func EncryptCBC

func EncryptCBC(plantText, key, iv []byte) ([]byte, error)

加密

func GetHkdfChainCode

func GetHkdfChainCode(master, salt []byte, index uint64) (key, chainCode []byte, err error)

获取hkdf链编码 @master []byte 随机数 @salt []byte 盐 @index uint64 索引,棘轮数

func HkdfChainCodeNew

func HkdfChainCodeNew(master, salt []byte, index uint64) (*[]byte, *[]byte, error)

获取hkdf链编码 @master []byte 随机数 @salt []byte 盐 @index uint64 索引,棘轮数

func HkdfChainCodeNewV3

func HkdfChainCodeNewV3(master, salt []byte, index uint64) (*[]byte, *[]byte, error)

获取hkdf链编码 @master []byte 随机数 @salt []byte 盐 @index uint64 索引,棘轮数

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS #7 填充字符串由一个字节序列组成,每个字节填充该字节序列的长度。 下面的示例演示这些模式的工作原理。假定块长度为 8,数据长度为 9,则填充用八位字节数等于 7,数据等于 FF FF FF FF FF FF FF FF FF: 数据: FF FF FF FF FF FF FF FF FF PKCS7 填充: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte, blockSize int) ([]byte, error)

func ParseAddrPrefix

func ParseAddrPrefix(addr AddressCoin) string

func Rand16Byte

func Rand16Byte() ([16]byte, error)

生成16字节(128位)的随机数

func Rand32Byte

func Rand32Byte() ([32]byte, error)

生成32字节(256位)的随机数

func ValidAddr

func ValidAddr(pre string, addr AddressCoin) bool

判断有效地址 @version []byte 版本号(如比特币主网版本号“0x00")

Types

type AddressCoin

type AddressCoin []byte

func AddressFromB58String

func AddressFromB58String(str string) AddressCoin

func BuildAddr

func BuildAddr(pre string, pubKey []byte) AddressCoin

通过公钥生成地址 @version []byte 版本号(如比特币主网版本号“0x00")

func (*AddressCoin) B58String

func (this *AddressCoin) B58String() string

Directories

Path Synopsis
Package crc implements generic CRC calculations up to 64 bits wide.
Package crc implements generic CRC calculations up to 64 bits wide.

Jump to

Keyboard shortcuts

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