I'm looking for a way to rearrange a string in Postgres. I need to make a string non-recognizable but it also needs to be reversible so a hashing function is out and so is anything that is randomly generated. In addition, I am working with strings that are 10 characters long, so I want to keep the resulting rearranged string in the same ballpark. This isn't a secure string, this is just to keep something form being immediately recognizable.
I'd like to create something along the lines of...
Select rearrange('12345abcde');
that will produce something like this...
'1a2b3c4d5e'
The rearranging function doesn't need to be identical, and if I was pointed in the right direction, I could adapt a function to my specific needs, but the length can vary and since I need to be able to reverse the procedure, it needs to be done in a non-random method.