Library for hashing passwords in Golang https://salif.github.io/hasher
Go to file
Salif Mehmed 6acb59a77b
update the cli tool
2021-04-22 18:34:16 +03:00
cmd/hasher update the cli tool 2021-04-22 18:34:16 +03:00
.gitignore Initial commit 2020-05-10 21:05:10 +03:00
LICENSE Initial commit 2020-05-10 21:05:10 +03:00
README.md update the cli tool 2021-04-22 18:34:16 +03:00
go.mod change package name and add version 2 2021-03-13 16:48:21 +02:00
go.sum change package name and add version 2 2021-03-13 16:48:21 +02:00
hasher.go change package name and add version 2 2021-03-13 16:48:21 +02:00
hasher_test.go update the cli tool 2021-04-22 18:34:16 +03:00

README.md

hasher

Library and cli tool for password hashing

The hashing algorithm is Argon2id.

The result is:

  • Hash: hexadecimal string with length of 64
  • Salt: hexadecimal string with length of 32
  • Version: int

Usage

Get

go get -u salif.eu/go/hasher

Import

import (
    "salif.eu/go/hasher"
)

Hash

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

Verify

var password = "password"
// get hash, salt and version from database
var ok = hasher.Verify(password, hash, salt, version)
if ok {
    // The password is correct
}

CLI tool

Install

go get -u salif.eu/go/hasher/cmd/hasher

Hash

echo -n "password" | hasher

or

hasher "filename"

Verify

echo -n "password" | hasher "hash" "salt" 2

or

hasher "filename" "hash" "salt" 2

License

This library is licensed under the MIT license