Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Day0Hasher = Hasher{hash0SHA256, compare0SHA256} // Sunday (SHA256) Day1Hasher = Hasher{hash1MD5, compare1MD5} // Monday (MD5) Day2Hasher = Hasher{hash2SHA512, compare2SHA512} // Tuesday (SHA512) Day3Hasher = Hasher{hash3SHA384, compare3SHA384} // Wednesday (SHA384) Day4Hasher = Hasher{hash4Bcrypt, compare4Bcrypt} // Thursday (Bcrypt) Day5Hasher = Hasher{hash5ARGON2, compare5ARGON2} // Friday (ARGON2) Day6Hasher = Hasher{hash6PBKDF2, compare6PBKDF2} // Saturday (PBKDF2) )
Functions ¶
func Compare ¶
Compares the data with the salt and the hash. If the hash is not in the correct format, it will return false.
Types ¶
type CompareFunc ¶
A compare function should return true if the data and salt match the hash.
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
A hasher is a struct that contains a hash function and a compare function.
The hash function should return a hash of the data and salt.
The compare function should return true if the data and salt match the hash.
type Key ¶
type Key interface { // Get the bytes crypto interface. Bytes() *_byteCrypto // Get the html safe crypto interface. HTMLSafe() *_htmlSafe // Get a new aes key from the secret key. KeyFromSecret() *[32]byte // Generate a sha256 hash from the secret key. Sha256() string // Verify a sha256 hash with the secret key. VerifySha256(hash string) bool // Sign a string with the secret key. Sign(data string) string // Verify a string with the secret key. Verify(data, signature string) bool // Raw returns the raw secret key. Raw() string }
Click to show internal directories.
Click to hide internal directories.