Hi all
Overview
In a web app that I am developing I need to email the user a piece of info. After logging on to the system they will enter this piece of info and it will use this, as well as other bits of info from the database.
This string though needs to be encrypted. It is not for security reasons as such, just to obfuscate the actual string value. It is not a database key, an ID or anything like that. Just a simple string that we do not store but instead send to the client. (Unfortunately I am not allowed to provide any more information on this :(
Once they have logged on and entered the string, it will be decrypted and displayed on the screen. As a result, the function (or two) needs to be two way.
Requirements:
1. Encrypt a short character string consisting of characters, numbers and spaces (max leng about 5).
2. The encrypted string should be of fixed length (of about 8 characters)
3. The decryption function should take this encrypted string and convert it back exactly.
4. Must not require any kind of server side install (I have access to the server but do not trust 'unknown' components and there is no budget for it as it's not mission critical).
I've tried:
Standard ROT13 functions
these only work with characters and the length is the same as the original string - so no good
MD5 Hashing
A project I worked on years ago had a MD5 hash and unhash function (I know MD% is one way, but this one wasn't :). There are a few sites that can MD5 hash a string and unhash it - but I can't find anything like this that actually displays the code. (I have an MD5 hashing function but not one to unhash it)
Various other code snippets
I've been googling this for hours, sorting through code trying to find something suitable. But no joy.
To re-iterate. The function(s) does not need to be massively complex - just enough to obfuscate the string and return a fixed length string that can then be decrypted.
I don't have the time to do it myself or I would :) Even though I just spent hours trying to find one :(