All Projects → lambdapioneer → argon2kt

lambdapioneer / argon2kt

Licence: MIT License
An Android/Kotlin binding for the Argon2 hash

Programming Languages

c
50402 projects - #5 most used programming language
kotlin
9241 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to argon2kt

Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (+244.44%)
Mutual labels:  argon2
CppSecurity
C++ Security Library
Stars: ✭ 24 (-33.33%)
Mutual labels:  argon2
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+961.11%)
Mutual labels:  argon2
Argon2id
Argon2id password hashing and verification for Go
Stars: ✭ 140 (+288.89%)
Mutual labels:  argon2
Orion
Usable, easy and safe pure-Rust crypto
Stars: ✭ 227 (+530.56%)
Mutual labels:  argon2
web trader
📊 Python Flask game that consolidates data from Nasdaq, allowing the user to practice buying and selling stocks.
Stars: ✭ 21 (-41.67%)
Mutual labels:  password-hash
Comeonin
Password hashing specification for the Elixir programming language
Stars: ✭ 1,166 (+3138.89%)
Mutual labels:  argon2
xmrigCC
RandomX, CryptoNight, AstroBWT, Argon2 and GhostRider CPU/GPU miner with Command&Control (CC) Server and Monitoring
Stars: ✭ 262 (+627.78%)
Mutual labels:  argon2
Argon2 Jvm
Argon2 Binding for the JVM
Stars: ✭ 245 (+580.56%)
Mutual labels:  argon2
lazysodium-java
A Java implementation of the Libsodium crypto library. For the lazy dev.
Stars: ✭ 110 (+205.56%)
Mutual labels:  argon2
Argon2rs
The pure-Rust password hashing library running on Argon2.
Stars: ✭ 157 (+336.11%)
Mutual labels:  argon2
Argon2 Browser
Argon2 library compiled for browser runtime
Stars: ✭ 197 (+447.22%)
Mutual labels:  argon2
keepassxc-pwned
Check your keepassxc database against previously breached haveibeenpwned passwords
Stars: ✭ 25 (-30.56%)
Mutual labels:  password-hash
Rust Argon2
Rust library for hashing passwords using Argon2.
Stars: ✭ 124 (+244.44%)
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 (-8.33%)
Mutual labels:  argon2
Argon2pw
Argon2 password hashing package for go with constant time hash comparison
Stars: ✭ 85 (+136.11%)
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 (+641.67%)
Mutual labels:  argon2
comeonin ecto password
Ecto type for saving encrypted passwords using Comeonin
Stars: ✭ 34 (-5.56%)
Mutual labels:  password-hash
PasswordSafe
Cross platform password manager.
Stars: ✭ 14 (-61.11%)
Mutual labels:  argon2
phc-crypto
Hashing algorithms simplified (supports Argon2, Bcrypt, Scrypt, and PBKDF2)
Stars: ✭ 22 (-38.89%)
Mutual labels:  argon2

Argon2Kt: An Android/Kotlin binding for the Argon2 hash

Argon2Kt is a binding for the Argon2 password hash that allows to do memory-hard password hashing easily and securely on Android. Check out this blog post for an introduction to password-based key derivation on Android.

This library uses JNI to bridge JVM/C and allows relying solely on direct-allocated ByteBuffers (see below). Naturally, it comes with an extensive test coverage and a sample app.

Argon2Kt is licensed under the MIT license. See the LICENSE file in the root directory.

CircleCI

Quick start 👩‍💻 👨‍💻

Add the dependency to your gradle.build file:

implementation 'com.lambdapioneer.argon2kt:argon2kt:1.3.0'

Use the Argon2Kt class to hash and verify using Argon2:

// initialize Argon2Kt and load the native library
val argon2Kt = Argon2Kt()

// hash a password
val hashResult : Argon2KtResult = argon2Kt.hash(
  mode = Argon2Mode.ARGON2_I,
  password = passwordByteArray,
  salt = saltByteArray,
  tCostInIterations = 5,
  mCostInKibibyte = 65536
)

println("Raw hash: ${hashResult.rawHashAsHexadecimal()}")
println("Encoded string: ${hashResult.encodedOutputAsString()}")

// verify a password against an encoded string representation
val verificationResult : Boolean = argon2Kt.verify(
  mode = Argon2Mode.ARGON2_I,
  encodedString = hashResult.encodedOutputAsString()
  password = passwordByteArray,
)

FAQ 🤔

How do I reduce the exposure of secrets in memory?

Internally, Argon2Kt uses direct-allocated ByteBuffers for passing around both secrets (e.g. password, hash), and outputs (e.g. raw hash).

In contrast to ByteArrays and Strings, direct-allocated ByteBuffers (usually) reside outside the JVM heap and maintain a fixed position. This allows easy passing between native libraries through the JVM world. For our purposes, it allows us to overwrite the content with confidence once we no longer need them. Therefore, using them is preferable.

Argon2Kt offers convenience methods to use ByteArrays and Strings instead. However, the JVM might move these in memory without overwriting the old location. Therefore, you can no longer make sure that the secrets are removed once they are no longer needed.

Can I use Argon2Kt in Java?

Of course. Checkout the SampleJavaClass.java source file for an example. Note that it is not included in the sample app APK although it compiles just fine.

I have problems with an UnsatisfiedLinkError in production. What can I do?

By default Argon2Kt uses the system's loader for .so files. However, for some models and configurations it is known to fail. You can use an alternative SoLoader such as ReLinker using the callback provided by the Argon2Kt constructor.

Contribute 👋

When contributing, please follow the following (common-sense) steps:

  • Create an issue before you write any code. This allows to guide you in the right direction.
    • If you are after a 1-5 line fix, you might ignore this.
  • In the pull-request explain the high-level goal and your approach. That provides valuable context.
  • Convince others (and yourself) that the change is safe and sound.
    • Run ./gradlew connectedAndroidTest and manually test the APK in release configuration using ./gradlew installRelease.

Sample app 📱

The repository comes with a sample app that you can install both in debug and release configuration. Just run ./gradlew installDebug or ./gradlew installRelease respectively.

Reference/BibTex 📚

If you want to reference Argon2Kt in documentation or articles, feel free to use this suggested BibTex snippet:

@misc{hugenroth2019argon2kt,
  author={{Daniel Hugenroth}},
  title={Argon2Kt},
  year={2019},
  url={https://github.com/lambdapioneer/argon2kt},
}
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].