Documentation ¶
Index ¶
- Variables
- func ByteSliceToUint64(b []byte) uint64
- func GetNamespace(stateAddressByteSlice []byte) []byte
- func GetNamespaceFromStateAddressHexString(stateAddressHexString string) []byte
- func GetRandomString(length int) string
- func GetStateAddress(namespace []byte, key []byte) []byte
- func GetStateAddressFromHexString(stateAddressHexString string) []byte
- func GetStateAddressHexString(namespace []byte, key []byte) string
- func GetStateHashFromStringKey(familyName, key string) []byte
- func GetStateHashFromUint64Key(familyName string, key uint64) []byte
- func SplitStateAddress(address []byte) ([]byte, []byte)
- func SplitStateAddressHexString(stateAddressHexString string) ([]byte, []byte)
- func StateAddressByteSliceToHexString(address []byte) string
- func StateAddressHexStringToByteSlice(address string) []byte
- func Uint64ToByteSlice(u uint64) []byte
- type Argon2PasswordHashAlgorithm
- type PasswordHashAlgorithmFactory
- func (p *PasswordHashAlgorithmFactory) AppendPasswordHashAlgorithm(pha iface.IPasswordHashAlgorithm)
- func (p *PasswordHashAlgorithmFactory) CheckPassword(password, encoded string) (bool, error)
- func (p *PasswordHashAlgorithmFactory) IsAlgorithmAvailable(algorithm string) bool
- func (p *PasswordHashAlgorithmFactory) MakePassword(password, salt, algorithm string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrHashComponentUnreadable = errors.New("argon2: unreadable component in hashed password") ErrHashComponentMismatch = errors.New("argon2: hashed password components mismatch") ErrAlgorithmMismatch = errors.New("argon2: algorithm mismatch") ErrIncompatibleVersion = errors.New("argon2: incompatible version") )
Errors returned by Argon2PasswordHashAlgorithm.
var ErrUnimplementedPasswordHashAlgorithm = errors.New("password hash algorithm is not" +
" implemented yet")
Functions ¶
func ByteSliceToUint64 ¶
ByteSliceToUint64 converts byte slice to uint64
func GetNamespace ¶
GetNamespace from state address byte slice
func GetNamespaceFromStateAddressHexString ¶
GetNamespaceFromStateAddressHexString returns address byte slice from state address hex string
func GetRandomString ¶
GetRandomString returns a securely generated random string.
func GetStateAddress ¶
GetStateAddress generates state address from namespace and key
func GetStateAddressFromHexString ¶
GetStateAddressFromHexString converts state hex string to byte slice
func GetStateAddressHexString ¶
GetStateAddressHexString generates hex state address from namespace and key
func GetStateHashFromStringKey ¶
GetStateHashFromStringKey generate 35 bytes length state hash from string based key
func GetStateHashFromUint64Key ¶
GetStateHashFromUint64Key generate 35 bytes length state hash from uint64 based key
func SplitStateAddress ¶
SplitStateAddress splits state address to namespace and key
func SplitStateAddressHexString ¶
SplitStateAddressHexString splits state address hex string to namespace and key
func StateAddressByteSliceToHexString ¶
StateAddressByteSliceToHexString converts byte slice to hex string
func StateAddressHexStringToByteSlice ¶
StateAddressHexStringToByteSlice converts hex address string to byte slice
func Uint64ToByteSlice ¶
Uint64ToByteSlice converts uint64 to byte slice
Types ¶
type Argon2PasswordHashAlgorithm ¶
type Argon2PasswordHashAlgorithm struct { // Defines the amount of computation time, given in number of iterations. Time uint32 // Defines the memory usage (KiB). Memory uint32 // Defines the number of parallel threads. Threads uint8 // Defines the length of the hash in bytes. Length uint32 }
Argon2PasswordHashAlgorithm implements Argon2i password hashing algorithm.
func NewArgon2PasswordHashAlgorithm ¶
func NewArgon2PasswordHashAlgorithm() *Argon2PasswordHashAlgorithm
NewArgon2PasswordHashAlgorithm secures password hashing using the argon2 algorithm.
func (*Argon2PasswordHashAlgorithm) Algorithm ¶
func (h *Argon2PasswordHashAlgorithm) Algorithm() string
type PasswordHashAlgorithmFactory ¶
type PasswordHashAlgorithmFactory struct {
// contains filtered or unexported fields
}
func DefaultPasswordHashAlgorithmFactory ¶
func DefaultPasswordHashAlgorithmFactory() *PasswordHashAlgorithmFactory
func NewPasswordHashAlgorithmFactory ¶
func NewPasswordHashAlgorithmFactory() *PasswordHashAlgorithmFactory
func (*PasswordHashAlgorithmFactory) AppendPasswordHashAlgorithm ¶
func (p *PasswordHashAlgorithmFactory) AppendPasswordHashAlgorithm(pha iface.IPasswordHashAlgorithm)
func (*PasswordHashAlgorithmFactory) CheckPassword ¶
func (p *PasswordHashAlgorithmFactory) CheckPassword(password, encoded string) (bool, error)
func (*PasswordHashAlgorithmFactory) IsAlgorithmAvailable ¶
func (p *PasswordHashAlgorithmFactory) IsAlgorithmAvailable(algorithm string) bool
func (*PasswordHashAlgorithmFactory) MakePassword ¶
func (p *PasswordHashAlgorithmFactory) MakePassword(password, salt, algorithm string) (string, error)