Skip to content
/ enigma Public
forked from benelsen/enigma

Implementation of an enigma machine

License

Notifications You must be signed in to change notification settings

greuze/enigma

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enigma

Implementation of an enigma machine

Installation

$ npm install enigma

Example

var enigmajs = require('enigma');

var rotorI        = new enigmajs.Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ', 'Q');
var rotorIII      = new enigmajs.Rotor('BDFHJLCPRTXVZNYEIWGAKMUSQO', 'V');
var rotorIV       = new enigmajs.Rotor('ESOVPZJAYQUIRHXLNFTGKDCMWB', 'J');
var reflector     = new enigmajs.Reflector('YRUHQSLDPXNGOKMIEBFZCWVJAT');
var plugboard     = new enigmajs.Plugboard( 'AD CN ET FL GI JV KZ PU QY WX' );
var entryWheel    = new enigmajs.EntryWheel('ABCDEFGHIJKLMNOPQRSTUVWXYZ');

var enigma = new enigmajs.Enigma([rotorI, rotorIV, rotorIII], reflector, plugboard, entryWheel);

console.log( enigma.string( 'EXAMPLEMESSAGE' ) );

Prints out RRHIUUFUVJLJYY

You should also have a look at this test which demonstrates a more realistic procedure to cipher/decipher a message.

Testing

$ npm test

Build Status

License

MIT

About

Implementation of an enigma machine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%