easy-enigma

An npm package to simulate an enigma machine


Project maintained by ArmoredVortex Hosted on GitHub Pages — Theme by mattgraham

Welcome to easy-enigma Documentation

Installation

NPM:

Quick Start

(scroll below for detailed instructions)

const enigmajs = require('enigmajs');

const rotor1 = enigmajs.rotor('BDFHJLCPRTXVZNYEIWGAKMUSQO', 'A');
const rotor2 = enigmajs.rotor('AJDKSIRUXBLHWTMCQGZNPYFVOE', 'A');
const rotor3 = enigmajs.rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ', 'A');
const reflector = enigmajs.reflector('YRUHQSLDPXNGOKMIEBFZCWVJAT');

const engine = enigmajs.engine([rotor1, rotor2, rotor3],reflector)

const message = 'Hello World'
console.log(engine.convert(message));

Features

Detailed Instructions

Import

const enigmajs = require('enigmajs');

Creating a rotor

const rotor1 = enigmajs.rotor(/* Rotor Configuration */, /* Current rotor position */);

Creating a reflector

const reflector = enigmajs.reflector(/* Reflector Configuration */);

Creating the enigma engine

const engine = enigmajs.engine( [/* rotor1, rotor2, rotor3 */], /* reflector */

Modifying rotor position on engine

engine.setRotorPositions(['A', 'A', 'A']);

Support or Contact

Having trouble? Contact me and I’ll help you sort it out.