Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCipher = errors.New("invalid cipher message")
ErrInvalidCipher describes an error in which the cipher message is invalid.
var ErrInvalidParam = errors.New("invalid param")
ErrInvalidParam describes an error in which the encryption parameter is invalid.
var ErrInvalidPassword = errors.New("invalid password")
ErrInvalidPassword describes an error in which the password is invalid.
var ErrMethodNotSupported = errors.New("cipher method is not supported")
ErrMethodNotSupported describes an error in which the cipher method is not known.
Functions ¶
func OptionIteration ¶
func OptionIteration(iterations uint32) func(p *argon2dParameters)
func OptionMemory ¶
func OptionMemory(memory uint32) func(p *argon2dParameters)
func OptionParallelism ¶
func OptionParallelism(parallelism uint8) func(p *argon2dParameters)
Types ¶
type Encrypter ¶
type Encrypter struct {
Method string `json:"method,omitempty"`
Params params `json:"params,omitempty"`
}
Encrypter keeps the method and parameters for the cipher algorithm.
func DefaultEncrypter ¶
DefaultEncrypter creates a new encrypter instance. If no option sets it uses the default parameters.
The default encrypter uses Argon2ID as password hasher and AES_256_CTR as encryption algorithm.
func NopeEncrypter ¶
func NopeEncrypter() Encrypter
NopeEncrypter creates a nope encrypter instance.
The nope encrypter doesn't encrypt the message and the cipher message is same as original message.
func (*Encrypter) Decrypt ¶
Decrypt decrypts the `cipher` using give `password` and returns the original message.
func (*Encrypter) Encrypt ¶
Encrypt encrypts the `message` using give `password` and returns the cipher message.