Documentation
¶
Overview ¶
Package blake256 implements BLAKE-256 and BLAKE-224 hash functions (SHA-3 candidate).
Index ¶
- Constants
- Variables
- func Base58Decode(input string, alphabetStr string) ([]byte, error)
- func Base58Encode(input []byte, alphabetStr string) string
- func Bech32Decode(address, alphabet string) ([]byte, error)
- func Bech32Encode(prefix, alphabet string, payload []byte, payloadPrefix []byte) string
- func DoubleBlake256(data []byte) []byte
- func IsLowerHex(data string) bool
- func New() hash.Hash
- func New224() hash.Hash
- func New224Salt(salt []byte) hash.Hash
- func NewSalt(salt []byte) hash.Hash
- type Base58Alphabet
- type CorruptInputError
- type Encoding
- func (enc *Encoding) Base64Decode(s string) ([]byte, error)
- func (enc *Encoding) Base64Encode(src []byte) string
- func (enc *Encoding) Decode(dst, src []byte) (n int, err error)
- func (enc *Encoding) DecodedLen(n int) int
- func (enc *Encoding) Encode(dst, src []byte)
- func (enc *Encoding) EncodedLen(n int) int
Constants ¶
const ( StdPadding rune = '=' // Standard padding character NoPadding rune = -1 // No padding )
const BlockSize = 64
The block size of the hash algorithm in bytes.
const Size = 32
The size of BLAKE-256 hash in bytes.
const Size224 = 28
The size of BLAKE-224 hash in bytes.
Variables ¶
var ( ErrorInvalidAddress = errors.New("Invalid address!") /* This table corresponding to the first 128 chars in ascii table.If the char is not one of "qpzry9x8gf2tvdw0s3jn54khce6mua7l" which is the code table of base32(Only consists of alphanumeric characters excluding "1", "b", "i", and "o"), -1 will be set in the corresponding position.Otherwise, the sequence number of alphanumeric character will be set. For example, '0'is the 48th(from 0 starts) char in ascii table and the 15th (from 0 starts)letter in code table, then 15 will be set in the 48th position. */ CHARSET_REV = []int8{}/* 128 elements not displayed */ )
var (
ErrorInvalidBase58String = errors.New("invalid base58 string")
)
Errors
Functions ¶
func Base58Decode ¶
Decode docode with custom Alphabet
func Base58Encode ¶
Encode encode with custom Alphabet
func Bech32Decode ¶
func Bech32Encode ¶
func DoubleBlake256 ¶
func IsLowerHex ¶
func New224Salt ¶
New224Salt is like New224 but initializes salt with the given 16-byte slice.
Types ¶
type Base58Alphabet ¶
type Base58Alphabet struct {
// contains filtered or unexported fields
}
Alphabet The base58 Alphabet object.
func NewBase58Alphabet ¶
func NewBase58Alphabet(alphabet string) *Base58Alphabet
NewAlphabet create a custom Alphabet from 58-length string. Note: len(rune(Alphabet)) must be 58.
type CorruptInputError ¶
type CorruptInputError int64
func (CorruptInputError) Error ¶
func (e CorruptInputError) Error() string
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
func NewEncoding ¶
NewEncoding returns a new padded Encoding defined by the given Alphabet, which must be a 64-byte string that does not contain the padding character or CR / LF ('\r', '\n'). The resulting Encoding uses the default padding character ('='), which may be changed or disabled via WithPadding.