0.0.3 • Published 7 years ago

enigma-ts v0.0.3

Weekly downloads
4
License
BSD-2-Clause
Repository
github
Last release
7 years ago

Enigma Build Status

TypeScript Enigma Machine Implementation.

Enigma M3 with three rotors, reflector and plugboard.

Work principle can be found here

Install

npm i enigma-ts

Usage

var Enigma = require('enigma-ts');

var enigma = new Enigma('AAA');

enigma.process('HELLO WORLD'); // LMHNH TMAUA

/**
* Or with configuration
* */

var default_config = {
   rotors: [
	   {'EKMFLGDQVZNTOWYHXUSPAIBRCJ': 'Q'},
	   {'AJDKSIRUXBLHWTMCQGZNPYFVOE': 'E'},
	   {'BDFHJLCPRTXVZNYEIWGAKMUSQO': 'V'},
   ],
   plugboard: ['AY', 'BR', 'CU', 'DH', 'EQ', 'FS', 'GL', 'IP', 'JX', 'KN', 'MO', 'TZ', 'VW'],
   reflector: 'YRUHQSLDPXNGOKMIEBFZCWVJAT',
};

enigma = new Enigma('OBY', default_config);

enigma.positions; // OBY

enigma.positions = 'AAA';

enigma.positions; // AAA

Test

npm i
npm test