format-preserving-encryption-java icon indicating copy to clipboard operation
format-preserving-encryption-java copied to clipboard

Generate same cypher for any length string

Open junejosheeraz opened this issue 5 years ago • 0 comments

Prerequisites

  • [X] Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filled: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aidealista
    • Checked that there is not already provided the described functionality

Description

I have successfully used the library to Encrypt and Decrypt values. See below;

Raw Value=1234567890123456, Encrypted=5959499404198841, Decrypted=1234567890123456
Raw Value=MNEMONIC, Encrypted= XXZI9ob, Decrypted=MNEMONIC
Raw Value=SOMEVALU, Encrypted=TC6WQj21, Decrypted=SOMEVALU
Raw Value=SOM, Encrypted=qVI, Decrypted=SOM
Raw Value=SOME, Encrypted=mJry, Decrypted=SOME
Raw Value=SOMEV, Encrypted=j4b4f, Decrypted=SOMEV

As you can see my requirement is that user would be storing the encrypted values in thier database and they would want to search on these encrypted values using LIKE '%' but this won't work because it generates different value depending on the length of the string. Is there anyway I can restrict the library to generate the value to be as follows;

Raw Value=SOMEVALU, Encrypted=TC6WQj21, Decrypted=SOMEVALU
Raw Value=SOM, Encrypted=TC6, Decrypted=SOM
Raw Value=SOME, Encrypted=TC6W, Decrypted=SOME
Raw Value=SOMEV, Encrypted=TC6WQ, Decrypted=SOMEV

Or am I missing the whole point?

Versions

1.0.0

junejosheeraz avatar Nov 21 '19 13:11 junejosheeraz