项目作者: daveyeb

项目描述 :
Enigma M3/M4 Simulator
高级语言: JavaScript
项目地址: git://github.com/daveyeb/node-enigma.git
创建时间: 2018-11-10T02:08:52Z
项目社区:https://github.com/daveyeb/node-enigma

开源协议:MIT License

下载


NPM Downloads" class="reference-link">node-enigma workflow status NPM Downloads

Node.js module to cipher and decipher messages.
This module is intended to imitate the operation of the Enigma M3/M4 developed during the WWII.
For more information on Enigma, visit Enigma Cipher Machine.

Contact me @daveyeb with any questions, feedback or bugs.

Install 🛠

  1. $ npm install node-enigma

Usage 📜

  1. import { encode, enigma, decode } from "node-enigma";
  2. const m4 = enigma({
  3. rotors: ["v", "iv", "iii", "beta"],
  4. reflector: "bthin",
  5. options: {
  6. plugboard: {
  7. W: "L",
  8. D: "N",
  9. },
  10. code: ["C", "D", "E"]
  11. },
  12. });
  13. var result = decode(m4, "OGRFHRJYV"); // XXXKMVOXH
  14. const m3 = enigma({
  15. rotors: ["v", "iv", "iii"],
  16. reflector: "ukwb",
  17. options: {
  18. plugboard: {
  19. Q: "V",
  20. S: "M",
  21. },
  22. code: ["A", "B", "C"]
  23. },
  24. });
  25. var result = decode(m3, "OGRFHRJYV"); // INAPICKLE
  26. const machine = enigma({
  27. rotors: ["i", "ii", "iii"],
  28. reflector: "ukwb",
  29. });
  30. var result = encode(machine, "BABYDRIVER"); //ADLVITPHWX

Refer to test directory for more basic usage

Contribute 🤝

Clone this repo to add custom wheels. Make a script inside the folder to test outputs with require('./lib/node-enigma'). Any fixes, cleanup or new features are always appreciated.