npm

@codankra/caeser

1.0.2 • Public • Published

Caeser Ψ4 Core Functions

Simple utility functions that implement the encryption technique of rotating or shifting text a fixed number of positions. Learn more!

import {
  getShiftedChar,
  rotateText,
  rotateTextThroughAlphabet,
} from "@codankra/caeser";

/* Shift alphabetic characters right or left. */
getShiftedChar("a", 2); // "c"
getShiftedChar("b", -2); // "z"

/* Numbers and symbols are not shifted */
getShiftedChar(")", 5); // ")"
getShiftedChar(3, 2); // 3

/* Shift blocks of text by a fixed amount */
rotateText("hello", 7); // "olssv"
rotateText("hello", 26); // "hello"

/* Generate a map of 26 shift possibilities throughout the English alphabet */
rotateTextThroughAlphabet("a"); // { 0: "a", 1: "b", ... }

Package Sidebar

Install

npm i @codankra/caeser

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

3.71 kB

Total Files

4

Last publish

Collaborators

  • codankra