hashing sensitive data

By : ChrisCa
Source: Stackoverflow.com

I need to scramble the names and logins of all the users in a UAT database we have. (because of the data protection act)

However, there is a catch.

The testers still need to be able to login using the hashed login names

so if a user login is "Jesse.J.James" then the hash should be something like


i.e. approximately the same length, with the dots in the same place

so MD5, sha1 etc would not be suitable as they would create very long strings and also add their own special characters such as + and = which are not allowed by the validation regex.

So I'm looking for some suggestions as to how to achieve this

I guess I need to rollmy own hashing algorith

anyone done anything similar?

I am using c# but I guess that is not so important to the algorithm

thanks alot


Thanks for all the answers. I think I am responsible for the confusion by using the word "Hash" when that is not what needed to be done

By : ChrisCa


Testers should NOT be logging in as legitimate users. That would clearly violate the non-repudiation requirement of whatever data protection act you're working under.

The system should not allow anyone to log in using the hashed value. That defeats the whole purpose of hashing!

I'm sorry I am not answering your specific question, but I really think your whole testing system should be reevaluated.


The comments below by JPLemme shed a lot of light on what you are doing, and I'm afraid that I completely misunderstood (as did those who voted for me, presumably).

Part of the confusion is based on the fact that hashes are typically used to scramble passwords so that no one can discover what another person's password is, including those working on the system. That is, evidently, the wrong context (and now I understand why you are hashing usernames instead of just passwords). As JPLemme has pointed out, you are actually working with a completely separate parrallel system into which live data has been copied and anonymized, and the secure login process that uses hashed (and salted!) passwords will not be molested.

In that case, WW's answer below is more relevant, and I recommend everyone to give your up votes to him/her instead. I'm sorry I misunderstood.

Did this recommendation go through your organization's auditing department? You might want to talk to them if not, it's not at all clear the scheme you're using protects your organization from liability.

thanks for all the answers. I think you are almost certainly right about our test strategy being wrong.

I'll see if I can change the minds of the powers that be

By : ChrisCa

This video can help you solving your question :)
By: admin