crypto-keygen-suite
Version:
Key generation utilities for cryptographic operations. YES I RENAMED IT. SIX STATE PROTOCOL!!! See its folder for all <3
35 lines (28 loc) • 809 B
JavaScript
// ROT13 HASHER TIME :SOB:
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
function rot13Cipher(message) {
const result = [];
for (let char of message) {
if (char.match(/[a-z]/i)) {
const code = char.charCodeAt(0);
const base = code >= 65 && code <= 90 ? 65 : 97;
const newChar = String.fromCharCode(((code - base + 13) % 26) + base);
result.push(newChar);
} else {
result.push(char);
}
}
return result.join('');
}
const argv = yargs(hideBin(process.argv))
.option('message', {
alias: 'm',
description: 'The message to apply ROT13 to',
type: 'string',
demandOption: true
})
.help()
.argv;
const result = rot13Cipher(argv.message);
console.log('ROT13 Result:', result);