Skip to main content

Fast Format Preserving Encryption (FPE) implementation in Rust

Project description

fastfpe

Fast Format Preserving Encryption (FPE) implementation in Rust with Python bindings.

Format-preserving encryption (FPE) is a cryptographic method that encrypts data while preserving its format. For example, encrypting a credit card number yields another valid-looking credit card number, making it useful for data protection while maintaining compatibility with existing systems.

Features

  • FF3-1 Format Preserving Encryption algorithm
  • Fast Rust implementation with Python bindings
  • Support for custom alphabets
  • Thread-safe

Installation

pip install fastfpe

Usage

>>> from fastfpe import ff3_1
>>> 
>>> key = "3eaa133d22a7ee2432fb8ecfde1e97d9106dcf26b9edaa52b3ed4acd9a9b8445"
>>> tweak = "5be49f26c1dbb7"  # 7 bytes, hex-encoded
>>> alphabet = "abcdef0123456789"
>>> plaintext = "024587931578"
>>> 
>>> # Encrypt
>>> ciphertext = ff3_1.encrypt(key, tweak, alphabet, plaintext)
>>> ciphertext
'd756b8704a2d'
>>> ff3_1.decrypt(key, tweak, alphabet, ciphertext)
'024587931578'

License

fastfpe is licensed under the MIT License. See LICENSE for more information.

fastfpe uses the rust-fpe library by johntyner under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastfpe-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl (297.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fastfpe-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl (297.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

fastfpe-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl (297.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file fastfpe-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fastfpe-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 088af65f649f8185071c27292846c0044fb0b2ffcbf1e9cb80e534564b58c7a9
MD5 5ccf5262f419f067fc7169a8bb78ed64
BLAKE2b-256 e63e90021dc988cced8af7a59ac70444b36e4a58234cac04d7489df148a4ca26

See more details on using hashes here.

File details

Details for the file fastfpe-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fastfpe-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c68f968fb59b05a42c92bded6c9055de09ba0bce357d6cbd8ed0a383e2c704fa
MD5 ca7359eccc3a2682e119f7c3831b6f13
BLAKE2b-256 bacc597ae9297deff00faaa884a7013ab82add721a5c345f74659872a1e49011

See more details on using hashes here.

File details

Details for the file fastfpe-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fastfpe-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6182edadb0ebf4466525fa53ba13b675017b69e661aa25729724ea3bf86b5f83
MD5 8e09d45db5bbacdcfc016bd03b0f7bea
BLAKE2b-256 8afdcf006e072056473117437665cf44eded5d01f25a694e4d76b5c2a376d505

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page