Cipher - Morse codecipher
CIPHER - MORSE CODE (METHOD)
Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes, or dits and dahs. Morse code is named after Samuel Morse, one of the inventors of the telegraph.
S.O.S example:
["...","---","..."," ","...","---","..."]
["s","o","s"," ","s","o","s"]
character to morse
contract Test is Cipher {
function morse(string memory c) public pure returns (string memory cipher) {
return char_to_morse_code(c);
}
}
morse to character
contract Test is Cipher {
function morse(string memory c) public pure returns (string memory cipher) {
return morse_to_char(c);
}
}
word method for cipher & decipher
// import -> https://github.com/mosi-sol/live-contracts-s4/blob/main/17-%20Cipher%20Morse%20code%201/WordEncodeDecode.sol
contract Test is WordCipher {
function morse(string[] memory c) public pure returns (string memory cipher) {
return _morse()(c);
}
}