Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AES-128 secret length. AES_128 = 16 // AES-192 secret length. AES_192 = 24 // AES-256 secret length. AES_256 = 32 )
Variables ¶
View Source
var ( ErrAesSecretLength = errors.New("[cryptor/AES] secret must be 16/24/32 bytes length") ErrAesMakeCipher = errors.New("[cryptor/AES] make cipher failed") ErrAesMakeGCM = errors.New("[cryptor/AES] make GCM failed") ErrAesOpenGCM = errors.New("[cryptor/AES] open GCM failed") ErrAesDecodeHEX = errors.New("[cryptor/AES] failed to decode hex") ErrAesReadNonce = errors.New("[cryptor/AES] read nonce failed") )
View Source
var ( // ErrInvalidHash in returned by ComparePasswordAndHash if the provided // hash isn't in the expected format. ErrArgonInvalidHash = errors.New("[cryptor/argon] hash is not in the correct format") // ErrIncompatibleVariant is returned by ComparePasswordAndHash if the // provided hash was created using a unsupported variant of Argon2. // Currently only argon2id is supported by this package. ErrArgonIncompatibleVariant = errors.New("[cryptor/argon] incompatible variant of argon2") // ErrIncompatibleVersion is returned by ComparePasswordAndHash if the // provided hash was created using a different version of Argon2. ErrArgonIncompatibleVersion = errors.New("[cryptor/argon] incompatible version of argon2") )
View Source
var ( // hash errors. ErrBcryptDataTooBig = errors.New("[cryptor/bcrypt] max password size is 72 bytes") // parse errors. // ErrBcryptHashWrongLength = errors.New("[cryptor/bcrypt] hash must have 60 bytes length") ErrBcryptNoDollar = errors.New("[cryptor/bcrypt] hash must have $ at start") ErrBcryptInvalidHash = errors.New("[cryptor/bcrypt] invalid hash") // ErrBcryptUnsupportedVersion = errors.New("[cryptor/bcrypt] this version not supported") ErrBcryptWrongCost = errors.New("[cryptor/bcrypt] cost NaN") // ErrBcryptSaltNotRadix = errors.New("[cryptor/bcrypt] salt not matches with radix") ErrBcryptHashNotRadix = errors.New("[cryptor/bcrypt] hash not matches with radix") )
Functions ¶
This section is empty.
Types ¶
type AES ¶
type AES struct {
Secret string
}
type Argon ¶
type Argon struct { // the amount of memory used by the algorithm (in kibibytes). Memory uint32 // the number of iterations over the memory. Iterations uint32 // the number of threads (or lanes) used by the algorithm. // Recommended value is between 1 and runtime.NumCPU(). Parallelism uint8 // length of the random salt. 16 bytes is recommended for password hashing. SaltLength uint32 // length of the generated key. 16 bytes or more is recommended. KeyLength uint32 }
describes the input parameters used by the Argon2id algorithm.
Click to show internal directories.
Click to hide internal directories.