@haydenhigg/atbash
Version:
A small library for atbash encryptions.
9 lines (6 loc) • 388 B
JavaScript
const atbash = function() {};
atbash.letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
atbash.convert = function(message) {
return message.toUpperCase().split('').map(c => this.letters.indexOf(c) !== -1 ? this.letters[25 - this.letters.indexOf(c)] : c).join('');
}
module.exports = atbash;