Mruby Argon2

The password hash Argon2, winner of PHC for mruby
Alternatives To Mruby Argon2
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Node Argon21,71027331010 days ago70November 04, 202318mitJavaScript
Node.js bindings for Argon2 hashing algorithm
Argon2id37227714 days ago2October 21, 20232mitGo
Argon2id password hashing and verification for Go
Noble Hashes37253711 days ago27August 23, 20233mitJavaScript
Audited & minimal JS implementation of hash functions, MACs and KDFs.
Password4j29242 months ago21September 14, 20235apache-2.0Java
Java cryptographic library that supports Argon2, bcrypt, scrypt and PBKDF2 aimed to protect passwords in databases. Easy to use by design, highly customizable, secure and portable. All the implementations follow the standards and have been reviewed to perform better in the JVM.
Phoenix Ecto Encryption Example266
8 days ago9Elixir
🔐 A detailed example for how to encrypt data in an Elixir (Phoenix v1.7) App before inserting into a database using Ecto Types
Argon2 Jvm26047512 years ago13October 02, 20213lgpl-3.0Java
Argon2 Binding for the JVM
Argon2 Browser23412422 years ago31June 05, 20214mitJavaScript
Argon2 library compiled for browser runtime
Ruby Argon22192383 months ago24December 27, 2022mitRuby
A Ruby gem offering bindings for Argon2 password hashing
Argon2_elixir209158192 months ago48October 09, 20234apache-2.0Elixir
Elixir wrapper for the Argon2 password hashing algorithm
Rust Argon2202461942 months ago16August 11, 20235apache-2.0Rust
Rust library for hashing passwords using Argon2.
Alternatives To Mruby Argon2
Select To Compare


Alternative Project Comparisons
Readme

Build Status

mruby-argon2

The password hash Argon2, winner of PHC for mruby

Installation

add this to your build_config.rb

  conf.gem mgem: 'mruby-argon2'

Installation Notes

This packages libargon2 with mruby, so if you link mruby against your app you already have all symbols for argon2. The argon2.h file is inside the mruby/build/mrbgems/mruby-argon2/include folder

Examples

Example with default options

out = Argon2.hash("a very long password")

if (Argon2.verify(out[:encoded], "a very long password"))
  puts "entrance granted"
end

Optional arguments

Argon2.hash has the following optional arguments:

salt: String # The salt to use, at least 8 characters, if you don't know what this is it's better left to the default value (default = 16 random bytes)

The secret parameter, which is used for keyed hashing. This allows a secret key to be input at hashing time (from some external location) and be folded into the value of the hash. This means that even if your salts and hashes are compromized, an attacker cannot brute-force to find the password without the key.

The ad parameter, which is used to fold any additional data into the hash value. Functionally, this behaves almost exactly like the secret or salt parameters; the ad parameter is folding into the value of the hash. However, this parameter is used for different data. The salt should be a random string stored alongside your password. The secret should be a random key only usable at hashing time. The ad is for any other data.

t_cost: Fixnum # Sets the number of iterations to N (default = 3)

m_cost: Fixnum # Sets the memory usage of N KiB (default = 2 << 12)

parallelism: Fixnum # Sets parallelism to N threads (default = 1)

hashlen: Fixnum # Sets hash output length to N bytes (default = 32)

type: Fixnum # You can choose between Argon2::I, Argon2::D or Argon2::ID (default = Argon2::I)

version: Fixnum # 0x10 or 0x13 (default = 0x13)

To find out more about them take a look at P-H-C/phc-winner-argon2

Example with optional arguments

out = Argon2.hash("a very long password", secret: "a very secure secret")

if Argon2.verify(out[:encoded], "a very long password", secret: "a very secure secret")
  puts "entrance granted"
end

Output values of Argon2.hash

Argon2.hash returns a ruby hash with the following fields

{
  salt: # the salt
  t_cost: # the number of itarations
  m_cost: # the memory usage
  parallelism: # the threads used
  type: # the Argon2 type, as a Number
  version: # the version number
  hash: # the raw hash calculated
  encoded: # the encoded String, suiteable for password Storage and verification
}

Notes for default arguments

The default arguments can change over time, they are taken from the command like argon2 utility.

Popular Argon2 Projects
Popular Hashing Projects
Popular Security Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
C
Hash
Hashing
Argon2