15 releases

new 0.3.4 Apr 16, 2024
0.3.2 Feb 17, 2024
0.2.8 Dec 7, 2023
0.2.7 Nov 29, 2023

#509 in Cryptography

Download history 10/week @ 2023-12-29 20/week @ 2024-01-05 17/week @ 2024-01-12 6/week @ 2024-01-19 1/week @ 2024-02-02 1/week @ 2024-02-09 333/week @ 2024-02-16 130/week @ 2024-02-23 29/week @ 2024-03-01 46/week @ 2024-03-08 29/week @ 2024-03-15 8/week @ 2024-03-22 18/week @ 2024-03-29 118/week @ 2024-04-05

178 downloads per month
Used in 4 crates

Apache-2.0 OR MIT

53KB
877 lines

abcrypt

CI Version MSRV Docs License

abcrypt is an implementation of the abcrypt encrypted data format.

Usage

Add this to your Cargo.toml:

[dependencies]
abcrypt = "0.3.4"

Example

use abcrypt::Params;

let data = b"Hello, world!\n";
let passphrase = "passphrase";

// Encrypt `data` using `passphrase`.
let ciphertext = abcrypt::encrypt(data, passphrase).unwrap();
assert_ne!(ciphertext, data);

// And extract the Argon2 parameters from it.
let params = Params::new(&ciphertext).unwrap();
assert_eq!(params.memory_cost(), 19456);
assert_eq!(params.time_cost(), 2);
assert_eq!(params.parallelism(), 1);

// And decrypt it back.
let plaintext = abcrypt::decrypt(ciphertext, passphrase).unwrap();
assert_eq!(plaintext, data);

Crate features

alloc

Enables features that require an allocator. This is enabled by default (implied by std).

std

Enables features that depend on the standard library. This is enabled by default.

serde

Enables serialization support for Params.

no_std support

This supports no_std mode. Disables the default feature to enable this.

Note that the memory blocks used by Argon2 when calculating a derived key is limited to 256 KiB when the alloc feature is disabled.

Documentation

See the documentation for more details.

Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.

Changelog

Please see CHANGELOG.adoc.

Contributing

Please see CONTRIBUTING.adoc.

License

Copyright © 2022–2024 Shun Sakai (see AUTHORS.adoc)

This library is distributed under the terms of either the Apache License 2.0 or the MIT License.

This project is compliant with version 3.0 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.

Dependencies

~1.3–1.8MB
~35K SLoC