Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kellsworks/fpe-ruby
Format Preserving Encryption Algorithm in Ruby
https://github.com/kellsworks/fpe-ruby
fpe fpe-ruby
Last synced: 1 day ago
JSON representation
Format Preserving Encryption Algorithm in Ruby
- Host: GitHub
- URL: https://github.com/kellsworks/fpe-ruby
- Owner: KellsWorks
- Created: 2023-09-29T05:38:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-29T10:53:36.000Z (about 1 year ago)
- Last Synced: 2023-09-30T07:02:25.032Z (about 1 year ago)
- Topics: fpe, fpe-ruby
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Format Preserving Encryption Algorithm in Ruby
Format preserving encryption (FPE) is a method of encryption where the resulting cipher text has the same form as the input clear text. The form of the text can vary according to use and the application. One example is a 16 digit credit card number. After using FPE to encrypt a credit card number, the resulting cipher text is another 16 digit number. In this example of the credit card number, the output cipher text is limited to numeric digits only.
The CSNBFPEE, CSNBFPED, CSNBFPET, and CSNBPTRE callable services implement the VISA Format Preserving Encryption algorithm, which is a counter mode stream cipher.
The CSNBFFXD, CSNBFFXE, and CSNBFFXT callable services implement the NIST FFX algorithms. The FF1, FF2, and FF2.1 algorithms are all built in a similar way, using AES as the base cipher for the operations. The overall algorithm uses a Pseudorandom Function (PRF) as its main encryption function using a variable length Feistal network. Each of the three algorithms contain a different PRF to achieve the result. Each algorithm also takes in a tweak string to further vary the action of the PRF. FF1 uses either a 128-bit AES key or a 256-bit AES key. FF2 and FF2.1 only support AES 128-bit keys.
On Decryption, you might not get the same value as the serial number before encryption.