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.2-cp312-cp312-manylinux_2_34_x86_64.whl (295.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fastfpe-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl (295.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

fastfpe-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl (295.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

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

File metadata

File hashes

Hashes for fastfpe-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1c6ac70d97e9befb9eec345f4a25a7e4134d95d0826ea79cee7861663efdc115
MD5 2cd458c5e890475a91f69569d249bc2a
BLAKE2b-256 1ae66f885a0a099ac1f61f5ec17f3b6b35596a0e59cd07ac3999ae4c2e16de79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastfpe-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ab7f5ecf2b27627eaba6c54a74275c71b84b23cc578530125855923eae7c3c6e
MD5 f3b90146c809ffa9f2a2ceb913f9ad67
BLAKE2b-256 cc1c146dd413e48b95c1bf5362c610e8faaad50e9b3f0eab5b90a4292d238af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastfpe-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2fa64e9518282dbe140b06b20233dd786bfb6d9d2c6363322f1b196c6f65d627
MD5 c7966faf036cdb51aefb6f30d91e3a76
BLAKE2b-256 566a0032e432d275091c17fbeb1bc5d244d46a36dce73746f0b957ab3cc2c55b

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