A doubling substitution cipher based on the Morse cipher.
- Case sensitive? ❌
- Deterministic? ✓
- Alphabet:
ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,:;?-_()'=+/@
- Characters not in alphabet will be: omitted or throwing an error (default)
The options are the same for both methods, encode
and decode
const options = {
keyAlphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', // Order of letters to encode/decode the input. Must contain 26 unique characters
failOnUnknownCharacter: true, // Should an error be thrown when a character is not included in the alphabet
}
import { fractionatedMorse } from 'cipher-collection'
console.log(fractionatedMorse.encode('Hello World')) // AGTCDHOTQODTCJ
import { fractionatedMorse } from 'cipher-collection'
const options = { alphabet: 'BCADEFGHIJKLMNOPQRSTUVWXYZ' }
console.log(fractionatedMorse.encode('Hello World', options)) // BGTADHOTQODTAJ
import { fractionatedMorse } from 'cipher-collection'
const silentFailOptions = {
failOnUnknownCharacter: false,
}
// Characters will be omitted
console.log(fractionatedMorse.encode('€€€Hello World', silentFailOptions)) //AGTCDHOTQODTCJ
import { fractionatedMorse } from 'cipher-collection'
console.log(fractionatedMorse.decode('AGTCDHOTQODTCJ')) // Hello World
import { fractionatedMorse } from 'cipher-collection'
const options = { alphabet: 'BCADEFGHIJKLMNOPQRSTUVWXYZ' }
console.log(fractionatedMorse.decode('BGTADHOTQODTAJ', options)) // Hello World
import { fractionatedMorse } from 'cipher-collection'
const silentFailOptions = {
failOnUnknownCharacter: false,
}
console.log(fractionatedMorse.decode('€€€AGTCDHOTQODTCJ', silentFailOptions)) //Hello World