0.1.1 • Published 6 years ago

@amanoese/enigma v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 years ago

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