Documentation ¶
Overview ¶
Package valuehash provides valuehashes.
Index ¶
- Variables
- func SHA256Checksum(b []byte) string
- type Bytes
- func (hs Bytes) Bytes() []byte
- func (hs Bytes) Equal(h Hash) bool
- func (hs Bytes) IsEmpty() bool
- func (hs Bytes) IsValid([]byte) error
- func (hs Bytes) MarshalBSONValue() (bsontype.Type, []byte, error)
- func (hs Bytes) MarshalJSON() ([]byte, error)
- func (hs Bytes) String() string
- func (hs *Bytes) UnmarshalBSONValue(t bsontype.Type, b []byte) error
- func (hs *Bytes) UnmarshalJSON(b []byte) error
- type Hash
- type HashGenerator
- type Hasher
- type L32
- type L64
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmptyHashError = util.NewError("empty hash") InvalidHashError = util.NewError("invalid hash") )
Functions ¶
func SHA256Checksum ¶
Types ¶
type Bytes ¶
type Bytes []byte
func NewBytesFromString ¶
func (Bytes) MarshalJSON ¶
func (*Bytes) UnmarshalBSONValue ¶
func (*Bytes) UnmarshalJSON ¶
type Hash ¶
type Hash interface { isvalid.IsValider util.Byter // NOTE usually String() value is the base58 encoded of Bytes() fmt.Stringer Equal(Hash) bool IsEmpty() bool }
func RandomSHA256 ¶
func RandomSHA256() Hash
func RandomSHA256WithPrefix ¶
RandomSHA256WithPrefix generate random hash with string-based prefix. To decode, it's structure is, - <8: length of bytes prefix><8: length of random hash><32: random hash><bytes prefix>
* 52 is max valid length of prefix
func RandomSHA512 ¶
func RandomSHA512() Hash
func RandomSHA512WithPrefix ¶
RandomSHA512WithPrefix generate random hash with string-based prefix. To decode, it's structure is, - <8: length of bytes prefix><8: length of random hash><64: random hash><bytes prefix>
* 20 is max valid length of prefix
type HashGenerator ¶
type HashGenerator interface {
GenerateHash() Hash
}
Click to show internal directories.
Click to hide internal directories.