Library for easy hashing passwords in Golang
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Salif Mehmed f2721dcd7c
change salt length from 16 to 32 and use constant-time hash comparison
2 months ago
cmd/hasher change salt length from 16 to 32 and use constant-time hash comparison 2 months ago
.gitignore Initial commit 3 months ago
LICENSE Initial commit 3 months ago
README.md change salt length from 16 to 32 and use constant-time hash comparison 2 months ago
go.mod change salt length from 16 to 32 and use constant-time hash comparison 2 months ago
go.sum change salt length from 16 to 32 and use constant-time hash comparison 2 months ago
hasher.go change salt length from 16 to 32 and use constant-time hash comparison 2 months ago
hasher_test.go change salt length from 16 to 32 and use constant-time hash comparison 2 months ago

README.md

hasher

Library for easy hashing and verifying passwords.

Hashing algorithm is Argon2id.

The parameters are:

  • Memory: 65536 B
  • Iterations: 1
  • Parallelism: 4
  • Salt length: 32

Usage

Import

import (
    "github.com/salifm/hasher"
)

Hash

var password string = "password"
hash, salt, err := hasher.Hash(password)
// save hash and salt to database

Verify

var password string = "password"
// get hash and salt from database
match, err := hasher.Verify(password, hash, salt)
if match {
    // The password is correct
}

License

This library is licensed under the MIT license