caesars-cipher
A library that provides a simple interface to the caesars cipher with a large range.
Uses the legal range of UTF-8 instead of the regular alphabet: 0x80 (128)
caesars-cipher/base64
: Converts to base64 then shifts them.
caesars-cipher/uri-encoded
: Encodes as uri then shifts them.
You can try it out at the widget at berkekaragoz.com.
Usage
import { caesarsCipher, caesarsDecipher } from "caesars-cipher/uri-encoded";
import {
base64caesarsCipher,
base64caesarsDecipher,
} from "caesars-cipher/base64";
// uri-encoded
caesarsCipher("Cipher", 10); // Mszro|
caesarsDecipher("Mszro|", 10); // Cipher
// base64
base64caesarsCipher("Cipher", 10); // [<v☺kQ`♥
base64caesarsDecipher("[<v☺kQ`♥", 10); // Cipher
Types:
type CaesarsCipher = (text: string, shiftAmount: number) => string;
type CaesarsDecipher = (cipheredText: string, shiftAmount: number) => string;