Updated comments and fixed a bug in the BLAKE2 algorithm.

main
Tylan Tyson 1 year ago
parent e7886a26fb
commit e1b3e943ce

@ -19,6 +19,6 @@ func (algorithm Algorithm) Hash(data []byte) (string, error) {
if err != nil {
return "", err
}
// Hash
// Return Hash
return fmt.Sprintf("$argon2id$v=%d$m=%d,t=%d,p=%d$%s$%s", argon2.Version, algorithm.memory, algorithm.time, algorithm.threads, base64.RawStdEncoding.EncodeToString(salt), base64.RawStdEncoding.EncodeToString(argon2.IDKey(data, salt, algorithm.time, algorithm.memory, algorithm.threads, algorithm.keyLen))), err
}

@ -9,6 +9,6 @@ type Algorithm struct {
func New(size int) Algorithm {
// Return Algorithm
return Algorithm{
size: size,
size: size / 2,
}
}

@ -23,6 +23,6 @@ func (Algorithm) CheckHash(data []byte, hashToCheck string) (bool, error) {
if err != nil {
return false, err
}
// Return Hash
// Return Match
return subtle.ConstantTimeCompare(hasher.Sum(nil), decodedHashToCheck) == 1, err
}

@ -23,6 +23,6 @@ func (Algorithm) CheckHash(data []byte, hashToCheck string) (bool, error) {
if err != nil {
return false, err
}
// Return Hash
// Return Match
return subtle.ConstantTimeCompare(hasher.Sum(nil), decodedHashToCheck) == 1, err
}

Loading…
Cancel
Save