PCI compliant hash of a credit card number

4.8k views Asked by At

Someone has queried me to see if they can use their customers credit card numbers as membership numbers.

So looking up the PCI requirements for storing credit card numbers it says that a one way hash of the credit card number is required. Page 38 - https://www.pcisecuritystandards.org/documents/PCI_DSS_v3.pdf

It doesn't however say what hashes are acceptable?

So really all I need to accomplish is to convert a card number into a membership number which will be a hashed credit card number.

What is the easiest hash to implement as I'm working with a proprietary scripting language.

3

There are 3 answers

0
Ioan On

Simple alternative: Use a persistent variable which is incremented every time a new membership number is required.

You can also use a random number, but then you have to ensure it hasn't been used.

Credit card numbers are not entirely random, meaning dictionary-based brute force attacks are easier than if fully random. And as mentioned in the comments, they change and could cause you legal trouble in terms of financial regulations.

0
PaulG On

The PCI documents do specify to use 'strong cryptography', and points you to the glossary of terms for more information.

Glossary states

"use industry-tested and accepted alogorithms [...] SHA-1 is an example of an industry-tested and accepted hashing algorithm. "

The trouble however, is that you need access to the raw card number in order to produce these hashes. If you have access to the raw card data, then the full weight of PCI compliance comes crashing down on you. You can't just hash these numbers and hope for the best, you need compliance in every aspect of PCI, including securing your network to PCI standards, maintaining information security policies for staff and so on.

Best practice is to avoid having card data pass through your network or systems at all. Let a third party provider manage this and return token ids. You could then safely map token ids to cardholders.

0
ptrk On

As far as I know, the auditors allow tokens ("hashes") preserving last 4, or even first 6 and last 4 digits. Then again, you are in PCI scope as long as the real numbers touch your devices.