Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romaleev/enigma-ts
TypeScript Enigma Machine Implementation
https://github.com/romaleev/enigma-ts
babel ecmascript ecmascript6 enigma enigma-ts es6 jasmine nodejs npm romaleev ts tsc tslint tslint-rules typescript
Last synced: 2 months ago
JSON representation
TypeScript Enigma Machine Implementation
- Host: GitHub
- URL: https://github.com/romaleev/enigma-ts
- Owner: romaleev
- Created: 2017-02-07T16:46:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-05T13:31:53.000Z (about 2 years ago)
- Last Synced: 2024-10-11T16:08:50.507Z (3 months ago)
- Topics: babel, ecmascript, ecmascript6, enigma, enigma-ts, es6, jasmine, nodejs, npm, romaleev, ts, tsc, tslint, tslint-rules, typescript
- Language: TypeScript
- Size: 192 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Enigma [![Build Status](https://travis-ci.org/romaleev/enigma-ts.svg)](https://travis-ci.org/romaleev/enigma-ts)
TypeScript [Enigma Machine](https://en.wikipedia.org/wiki/Enigma_machine) Implementation.
Enigma M3 with three rotors, reflector and plugboard.
Work principle can be found [here](https://www.theguardian.com/technology/2014/nov/14/how-did-enigma-machine-work-imitation-game)
## Install
```bash
npm install
```## Usage
```JavaScript
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
```bash
npm test
```