Well, whether it is legal or not, if I write the code myself then how can the use of an algorithm be policed? lol
The inspiration for my question came from a documentary I was watching on the Discovery channel the other day about the American Civil War. The Confederates were using a code that was almost ancient and was cracked by the North. Despite that, it was actually an interesting method for encoding messages, but far too easy to crack these days.