Skip to content

Format Preserving Encryption for Credit Card Numbers using AES

License

Notifications You must be signed in to change notification settings

giorgos314/fpecredit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fpecredit

Format Preserving Encryption for Credit Card Numbers. For when you need to encrypt a 16-digit number into a 16-digit number using AES.

This script was created for a University of Piraeus project.

Inspired from this blog post by M.Green.

Requirements

  • Python 3.4 or newer
  • PyCrypto
    • sudo pip3 install pycrypto
  • Bitstring
    • sudo pip3 install bitstring

Usage

There are multiple ways you can use fpecredit.py:

For encryption, use the following command. You will be asked for a card number, AES encryption key and the desired amount of Feistel rounds.

python3 fpecredit.py enc

Similarly, for the decryption. Keep in mind that you need to use the same key and amount of rounds for encryption and decryption.

python3 fpecredit.py dec

You can also use testing mode by running one of the following:

Runs encryption with random input:

python3 fpecredit.py test

Runs encryption/decryption with a default key, for a default amount of 5 rounds:

python3 fpecredit.py testenc

python3 fpecredit.py testdec

About

Format Preserving Encryption for Credit Card Numbers using AES

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages