@amanoese/enigma

enigmaのNode.jsによるシンプルな実装です。

Usage no npm install needed!

<script type="module">
  import amanoeseEnigma from 'https://cdn.skypack.dev/@amanoese/enigma';
</script>

README

enigma

Build Status npm version

enigmaのNode.jsによるシンプルな実装です。

Install

$ npm install @amanoese/enigma

Usage

const Enigma = require('@amanoese/enigma')

//ローターとプラグボード、リフレクターの位置を保存
let save_rotor = new Enigma().toJSON()

//送信側のエニグマを生成
//ローターとプラグボード、リフレクターの位置を設定
let send_enigma = new Enigma(save_rotor);
let encryptOutput = send_enigma.typeString('HELLO')

console.log(encryptOutput) // HELLOではない英字列

//受信側のエニグマを生成
//ローターとプラグボード、リフレクターの位置を設定
let receve_enigma = new Enigma(save_rotor);
let decryptOutput = receve_enigma.typeString(encryptOutput)

console.log(decryptOutput) // HELLO