Credit Card Concealer Demo

This page uses Hazel Tags and tokens to confirm that a card is 13 to 16 digits long and composed of nothing but numerals. The page then goes on to scramble several digits of the card number.

For real-life use, you'd vary the encryption formula somewhat to make it unique to you (don't use a published encryption system!) and put it in your store_invoice.txt template. Obviously, you'd omit all documentation and clues to how to decrypt the number.

In this version, no attempt is made to prevent a "bad" number from being processed. You could easily throw a Hazel-True tag around the processing code to block bad numbers from being run. However, this code is intended to go on the store invoice template, and it is assumed that the credit card number has already been tested by Hazel before getting to this point, so there's likely no need to test the number in real life. Here's we're just demonstrating ways to test and process the card numbers.

Enter a test credit card number here:

CLIENT= %HZE_CLIENT
CREDTEST= %HZV_CREDTEST
First 2 of Credtest = %HZV_02L_CREDTEST
Last 2 of Client = %HZE_02R_CLIENT
Note: because the client ID can include hexadecimal values, and thus the letters A-F, it isn't really that good a seed for this process. Since we're doing a demo and I didn't want to publish a valid procedure that a bad guy could read, I have left this flaw in. If your Client ID puts letters into the last two places, fire up a Hazel-Forget command to reset things and start over. In real life, you would use a different seed, or use Hazel-Strip to filter the letters out, etc.

Credit Card Length Check

The credit card number %HZE_CREDTEST is %HZH_Word digits long and contains only numeric characters.
The test to check if the card is of valid length and contains only valid characters reports back %HZV_ValidCard.
The credit card number is %HZV_CREDLENGTH characters long.

Using the direct Hazel-Length tag, The card number is characters long.

The full value of Credtest is %HZE_CREDTEST

Innards is %HZV_INNARDS.
The first %HZV_LEFTLENGTH characters of CREDTEST are %HZ{E_%HZV_INNARDS}.
The last 7 characters of CREDTEST are %HZE_07R_CREDTEST.
SCRAMBLER = %HZV_scrambler

The first %HZV_LEFTLENGTH characters of CREDTEST are %HZ{E_%HZV_INNARDS}. The scrambler variable is = %HZV_SCRAM
When the last 7 digits of the card number are added to the scrambler variable the result is %HZV_SCRAM

The scrambled card number is %HZV_scrambled_cred.

The number in clear is %HZV_credtest.

To derive the original credit card number, multiply the first two digits of the card number by the last two digits of the client number, and use the 4 right-hand digits of that number. Subtract that result from the scrambled card number. (If there are fewer than 4 digits, use the complete number.)

In an abundance of caution, the programming uses a 7-digit sub-string of the number for the subtraction operation to ensure all the digits that could possibly be affected are present. The programming then concatenates the first part of the card number -- in the present pass, %HZV_LEFTLENGTH digits -- to the unscrambled 7 right-hand digits. Decryption result: %HZV_FRONT%HZV_07R_descrambled.