package
0.0.0-20241116163126-f19f100d9759
Repository: https://github.com/bradenhc/kolob.git
Documentation: pkg.go.dev
# Functions
CheckDataHash compares a slice of byte data with a hash using SHA-256.
HashPassword compares a plain-text password against a byte hash of a password hashed using the Bcrypt algorithm.
Decrypt uses AES-256 to decrypt the provided ciphertext and produce a newly allocated byte slice of the plaintext contents.
Encrypt uses AES-256 to encrypt the provided plaintext and produce a newly allocated byte slice of ciphertext.
HashData produces a byte hash of the provided data using the SHA-256 hashing algorithm.
HashPassword produces a byte hash of the provided password using the Bcrypt algorithm.
LoadSalt verifies that an existing byte slice only contains saltlen bytes.
No description provided by the author
NewDerivedKey uses the PBKDF2 key derivation algorithm to create a 256-bit key that can be used by the AES algorithm for encrypting and decrypting data.
NewPassword verifies the provided string value meets the criteria for a password and then wraps it in the Password type to indicate the string has been validated.
NewRandomKey uses a cryptographically strong random generator to create a 256-bit key that can be used by the AES algorithm for encrypting and decrypting data.
NewSalt creates a new slice containing saltlen bytes.
# Constants
HashCost is the cost used by the Bcrypt algorithm when hashing a password.
Iterations is the number of iterations used when generating a key with PBKDF2.
KeyLength is the length of the key generated by PBKDF2 for encrypting data.
MaxPasswordLength is the maximum number of bytes a password can contain.
MinPasswordLength is the minimum number of characters that must be contained in a user-provided password.
SaltLength is the length of the salt used by PBKDF2 when generating a key.
# Type aliases
DataHash is a hash of arbitrary data using SHA-256 represented as a 32-byte slice of bytes.
Key is the slice of keylen bytes used to encrypt data with AES-256.
PassHash is a hash of a password performed by Bcrypt represented as a slice of bytes.
Password is a user-provided string that has been validated and meets all criteria for a password.
Salt is the slice of saltlen bytes used when generating a key from a user-provided password.