Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benelsen/enigma
(Mechanical) implementation of an enigma machine
https://github.com/benelsen/enigma
Last synced: 4 months ago
JSON representation
(Mechanical) implementation of an enigma machine
- Host: GitHub
- URL: https://github.com/benelsen/enigma
- Owner: benelsen
- License: mit
- Archived: true
- Created: 2012-12-29T14:49:33.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-24T09:50:32.000Z (about 9 years ago)
- Last Synced: 2024-08-09T21:11:54.279Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 208 KB
- Stars: 61
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# enigma
Implementation of an enigma machine
[![Build Status](https://travis-ci.org/benelsen/enigma.png?branch=master)](https://travis-ci.org/benelsen/enigma)
## Installation
$ npm install enigma
## Example
```js
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](test/enigma-realmessage.js) which demonstrates a more realistic procedure to cipher/decipher a message.
## License
[MIT](LICENSE)