Ciphers
Morse code
Letters and digits to dots and dashes. A space between letters, a slash between words.
- create
- create("morse")
- family
- Fractionation
- options
- none
- self-inverse
- no
- keyspace
- 1 (fixed table)
- try it
- ciphers morse "SOS"
International Morse. Each letter or digit becomes dots and dashes, letters separated by one space, words by /. Common punctuation has a code too. A character without one passes through as it is.
const morse = create("morse");
morse.encode("SOS").text; // "... --- ..."
morse.encode("SOS HELP").text; // "... --- ... / .... . .-.. .--."
morse.encode("A, B?").text; // ".- --..-- / -... ..--.."
morse.decode("... --- ... / .... . .-.. .--.").text; // "SOS HELP"
Decoding doesn't care about extra spaces around the slash. Output is uppercase, Morse has no case.