All Projects → alexedwards → Argon2id

alexedwards / Argon2id

Licence: mit
Argon2id password hashing and verification for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Argon2id

lazysodium-java
A Java implementation of the Libsodium crypto library. For the lazy dev.
Stars: ✭ 110 (-21.43%)
Mutual labels:  argon2
Fscrypt
Go tool for managing Linux filesystem encryption
Stars: ✭ 534 (+281.43%)
Mutual labels:  argon2
Lazysodium Android
An Android implementation of the Libsodium cryptography library. For the lazy dev.
Stars: ✭ 69 (-50.71%)
Mutual labels:  argon2
crypthash-net
CryptHash.NET is a .NET multi-target library to encrypt/decrypt/hash/encode/decode strings and files, with an optional .NET Core multiplatform console utility.
Stars: ✭ 33 (-76.43%)
Mutual labels:  argon2
Argon2 Cffi
Secure Password Hashes for Python
Stars: ✭ 264 (+88.57%)
Mutual labels:  argon2
Halite
High-level cryptography interface powered by libsodium
Stars: ✭ 933 (+566.43%)
Mutual labels:  argon2
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (+90.71%)
Mutual labels:  argon2
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-11.43%)
Mutual labels:  argon2
Xmrig
RandomX, CryptoNight, AstroBWT and Argon2 CPU/GPU miner
Stars: ✭ 6,372 (+4451.43%)
Mutual labels:  argon2
Pinkman
PINkman is a library to help implementing an authentication by a PIN code in a secure manner. The library derives hash from the user's PIN using Argon2 function and stores it in an encrypted file. The file is encrypted with the AES-256 algorithm in the GCM mode and keys are stored in the AndroidKeystore.
Stars: ✭ 59 (-57.86%)
Mutual labels:  argon2
PasswordSafe
Cross platform password manager.
Stars: ✭ 14 (-90%)
Mutual labels:  argon2
argon2kt
An Android/Kotlin binding for the Argon2 hash
Stars: ✭ 36 (-74.29%)
Mutual labels:  argon2
Node Argon2
Node.js bindings for Argon2 hashing algorithm
Stars: ✭ 1,008 (+620%)
Mutual labels:  argon2
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+172.86%)
Mutual labels:  argon2
Comeonin
Password hashing specification for the Elixir programming language
Stars: ✭ 1,166 (+732.86%)
Mutual labels:  argon2
phc-crypto
Hashing algorithms simplified (supports Argon2, Bcrypt, Scrypt, and PBKDF2)
Stars: ✭ 22 (-84.29%)
Mutual labels:  argon2
Globaleaks
GlobaLeaks is free, open source software enabling anyone to easily set up and maintain a secure whistleblowing platform.
Stars: ✭ 832 (+494.29%)
Mutual labels:  argon2
Rust Argon2
Rust library for hashing passwords using Argon2.
Stars: ✭ 124 (-11.43%)
Mutual labels:  argon2
Argon2pw
Argon2 password hashing package for go with constant time hash comparison
Stars: ✭ 85 (-39.29%)
Mutual labels:  argon2
Unchained
Secure password hashers for Go compatible with Django
Stars: ✭ 46 (-67.14%)
Mutual labels:  argon2

Argon2id

This package provides a convenience wrapper around Go's argon2 implementation, making it simpler to securely hash and verify passwords using Argon2.

It enforces use of the Argon2id algorithm variant and cryptographically-secure random salts.

Usage

package main

import (
	"log"

	"github.com/alexedwards/argon2id"
)

func main() {
	// CreateHash returns a Argon2id hash of a plain-text password using the
	// provided algorithm parameters. The returned hash follows the format used
	// by the Argon2 reference C implementation and looks like this:
	// $argon2id$v=19$m=65536,t=3,p=2$c29tZXNhbHQ$RdescudvJCsgt3ub+b+dWRWJTmaaJObG
	hash, err := argon2id.CreateHash("pa$$word", argon2id.DefaultParams)
	if err != nil {
		log.Fatal(err)
	}

	// ComparePasswordAndHash performs a constant-time comparison between a
	// plain-text password and Argon2id hash, using the parameters and salt
	// contained in the hash. It returns true if they match, otherwise it returns
	// false.
	match, err := argon2id.ComparePasswordAndHash("pa$$word", hash)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("Match: %v", match)
}

Changing the Parameters

When creating a hash you can and should configure the parameters to be suitable for the environment that the code is running in. The parameters are:

  • Memory — The amount of memory used by the Argon2 algorithm (in kibibytes).
  • Iterations — The number of iterations (or passes) over the memory.
  • Parallelism — The number of threads (or lanes) used by the algorithm.
  • Salt length — Length of the random salt. 16 bytes is recommended for password hashing.
  • Key length — Length of the generated key (or password hash). 16 bytes or more is recommended.

The Memory and Iterations parameters control the computational cost of hashing the password. The higher these figures are, the greater the cost of generating the hash and the longer the runtime. It also follows that the greater the cost will be for any attacker trying to guess the password.

If the code is running on a machine with multiple cores, then you can decrease the runtime without reducing the cost by increasing the Parallelism parameter. This controls the number of threads that the work is spread across. Important note: Changing the value of the Parallelism parameter changes the hash output.

params := &Params{
	Memory:      128 * 1024,
	Iterations:  4,
	Parallelism: 4,
	SaltLength:  16,
	KeyLength:   32,
}


hash, err := argon2id.CreateHash("pa$$word", params)
if err != nil {
	log.Fatal(err)
}

For guidance and an outline process for choosing appropriate parameters see https://tools.ietf.org/html/draft-irtf-cfrg-argon2-04#section-4.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].