There are several problems with the behavior: > *Main> encrypt "" > "XXXXX " > *Main> decrypt $ encrypt "" > "TANZP XXXXX " So fixing this case would be the first thing to do, followed by: > *Main> encrypt "hello" > "LBVJW XXXXX " > *Main> decrypt $ encrypt "hello" > "HELLO YFRTQ XXXXX "