5 releases

0.1.4 Mar 17, 2024
0.1.3 Mar 17, 2024
0.1.2 Feb 28, 2024
0.1.1 Feb 26, 2024
0.1.0 Feb 25, 2024

#1869 in Cryptography

Apache-2.0 OR MIT

63KB
981 lines

Python Bindings for abcrypt

CI PyPI Version PyPI Python Version crates.io Version MSRV Docs License

abcrypt-py is the Python bindings for the abcrypt crate.

Usage

Installation

To install this library:

pip install abcrypt-py

Example

from typing import Final

import abcrypt_py

DATA: Final[bytes] = b"Hello, world!\n"
PASSPHRASE: Final[bytes] = b"passphrase"

# Encrypt `DATA` using `PASSPHRASE`.
ciphertext = abcrypt_py.encrypt(DATA, PASSPHRASE)
assert ciphertext != DATA

# And extract the Argon2 parameters from it.
params = abcrypt_py.Params(ciphertext)
assert params.memory_cost == 19456
assert params.time_cost == 2
assert params.parallelism == 1

# And decrypt it back.
plaintext = abcrypt_py.decrypt(ciphertext, PASSPHRASE)
assert plaintext == DATA

Documentation

See the documentation for more details.

Minimum supported Rust version

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

Development

maturin is required for development of this library.

python3 -m venv venv
source venv/bin/activate
maturin develop
pip3 install abcrypt-py[test,dev]

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

~4.5–10MB
~94K SLoC