Here is a form that will generate all possible combinations of a word. BTW it was meant to scramble letters, but of course it's really the same thing as unscrambling.
Thanks for the reply martin, but that code seems more like an anagram solver than what I was looking for.
For example I may have the word "DGSA". The unencrypted version of this word would be "CATS". In this case
C=D
A=G
T=S
S=A
I'm sure there is a way to adopt your code to do this (I would have to use a whole alphabet, instead of just the 4 letters from the word), but the logic behind solving this problem is just not clicking with me.
On second thought, maybe I can use your program to generate all of the possible alphabets and then use those alphabets as to replace letters in the string.