Documentation
¶
Index ¶
Constants ¶
View Source
const ( BcryptDefaultCost = bcrypt.DefaultCost BcryptMaxCost = bcrypt.MaxCost BcryptMinCost = bcrypt.MinCost )
Variables ¶
This section is empty.
Functions ¶
func DecryptAES256GCM ¶
Decrypt data with AES-256-GCM algorithm, like `AES256GCM.Decrypt()` but fully functional
func EncryptAES256GCM ¶
Encrypt data with AES-256-GCM algorithm, like `AES256GCM.Encrypt()` but fully functional
Types ¶
type AES256GCM ¶
type AES256GCM interface { // Encrypt data with AES-256-GCM algorithm Encrypt(text []byte) ([]byte, error) // Decrypt data with AES-256-GCM algorithm Decrypt(text []byte) ([]byte, error) }
func NewAES256GCM ¶
Create new encrypt/decrypt with AES-256-GCM algoritm
type Argon2 ¶
type Argon2 interface { // Hash text with argon2 algorithm with format from `hashFormat` or you can determine your specific format Hash(text []byte) (string, error) // Compare plain text with hash argon2, return `true“ and error `nil` if equal Compare(text, hashedText []byte) (bool, error) // Set memory for argon2 parameter SetMemory(memory uint32) Argon2 // Set iterations for argon2 parameter SetIterations(iterations uint32) Argon2 // Set parallelism for argon2 parameter SetParallelism(parallelism uint8) Argon2 }
func NewArgon2 ¶
func NewArgon2() Argon2
Create argon2 hash with default parameter. Compatible with nodejs library `https://github.com/ranisalt/node-argon2.git` if you set `memory = 65536` and `parallelism = 4` because default parameter of my lib is `memory = 4096` and `parallelism = 1`
type Bcrypt ¶
type Bcrypt interface { // Hash plain text with bcrypt algoritm Hash(plainText []byte) ([]byte, error) // Compare plain text with hashed text with bcrypt algorithm Compare(plainText, hashedText []byte) error // Set cost of bcrypt algoritm. By default using `cryptography.BcryptDefaultCost` SetCost(cost int) Bcrypt // Get cost used of this bcrypt algoritm GetCost() int // Count cost value from hashed text with bcrypt algorithm. This method will not set `cost` of existing bcrypt CostFromHash(hashedText []byte) (int, error) }
Click to show internal directories.
Click to hide internal directories.