mrandrewmills / substitution-cipher

JavaScript object for playing with simple monoalphabetic substitution ciphers.
0 stars 0 forks source link

encrypt() and decrypt() - better handling of non-alphas? #2

Closed mrandrewmills closed 9 years ago

mrandrewmills commented 9 years ago

Currently, any non-alphabetical character gets converted into a space by the encrypt() and decrypt() methods. So, apostrophes, quotes, hyphens, periods, all of that, gets turned into a space character.

How do real-life substitution ciphers handle such things? Need to do more research.

mrandrewmills commented 9 years ago

Examined how ROT-13 does it, and non-alphas get passed through as is rather than stripped out. So I've altered encrypt() and decrypt() to do the same here.