Crates.io | argon2-async |
lib.rs | argon2-async |
version | 0.2.0 |
source | src |
created_at | 2021-12-06 01:28:22.252304 |
updated_at | 2022-04-18 02:25:23.101778 |
description | async wrapper for the argon2 crate |
homepage | https://github.com/tazz4843/argon2-async |
repository | https://github.com/tazz4843/argon2-async |
max_upload_size | |
id | 492942 |
size | 75,053 |
This crate provides a relatively nice async wrapper for the argon2
crate.
This crate is runtime agnostic. It defaults to using the tokio
runtime when pulled in with default features,
but that can be changed. Support for other runtimes is lower on my priority list, though.
tokio
as the underlying runtime:[dependencies]
argon2-async = "0.1"
async-std
as the underlying runtime:[dependencies]
argon2-async = { version = "0.1", default-features = false, features = ["async-std-rt"] }
[dependencies]
argon2-async = { version = "0.1", default-features = false, features = ["any-rt"] }
In your code, be sure to call argon2_async::set_config
before attempting to use any other methods.
async fn main() {
// It is *strongly* recommended to not use this as your default config,
// as it is insecure.
let config = argon2_async::Config::default();
argon2_async::set_config(config).await.expect("setting config failed");
}
The default config is very insecure, but is extremely fast, ideal for development environments. A helper tool is built in to find a production-ready config. To use it, run the following on a production machine (or one with equivalent hardware):
git clone https://github.com/tazz4843/argon2-async
cd argon2-async
RUSTFLAGS="-Ctarget-cpu=native" cargo run --release
This will test a few config settings one by one, and any with a 👍 beside are good configs for production.