{"_id":"3n16m4-m4ch1n3","_rev":"2-14e9bfb0d771089709073938f30034bb","name":"3n16m4-m4ch1n3","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"3n16m4-m4ch1n3","version":"0.0.1","description":"A modern interpretation of the infamous enigma machine","main":"lib/3n16m4-m4ch1n3.commonjs.js","types":"source/index.ts","module":"lib/3n16m4-m4ch1n3.esm.js","bin":{"3n16m4-m4ch1n3":"bin/3n16m4-m4ch1n3.js"},"repository":{"url":"git+https://github.com/MattAndDev/3n16m4-m4ch1n3.git"},"scripts":{"start":"nodemon --watch 'source/**/*.ts' --exec 'ts-node' source/dev.ts","bundle":"npx rollup -c rollup.config.js","prepublishOnly":"npm run bundle","test":"jest ./source/*","test:watch":"jest --watch ./source/*","pretty:lint":"prettier ./  --write && eslint ./source --ext .ts --fix"},"keywords":[],"devDependencies":{"@rollup/plugin-commonjs":"^15.0.0","@rollup/plugin-node-resolve":"^9.0.0","@types/jest":"^26.0.10","@types/minimist":"^1.2.0","@types/node":"^14.6.0","@types/seedrandom":"^2.4.28","@typescript-eslint/eslint-plugin":"^3.9.1","@typescript-eslint/parser":"^3.9.1","eslint":"^7.7.0","eslint-config-prettier":"^6.11.0","eslint-plugin-jest":"^23.20.0","eslint-plugin-prettier":"^3.1.4","husky":"^4.2.5","jest":"^26.4.0","lint-staged":"^10.2.11","nodemon":"^2.0.4","prettier":"^2.0.5","rollup":"^2.26.4","rollup-plugin-add-shebang":"^0.3.1","rollup-plugin-typescript2":"^0.27.2","ts-jest":"^26.2.0","ts-loader":"^8.0.2","ts-node":"^8.10.2","tslib":"^2.0.1","typescript":"^3.9.7"},"author":{"name":"Matteo Maroanati","email":"mail@matteo.land","url":"https://matteo.land"},"license":"WTFPL","husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"**/*.ts":["prettier --write","eslint ./source --ext .ts --fix"]},"dependencies":{"minimist":"^1.2.5","seedrandom":"^3.0.5"},"gitHead":"51985944954eea63f26fcf696604bb7bb0534255","bugs":{"url":"https://github.com/MattAndDev/3n16m4-m4ch1n3/issues"},"homepage":"https://github.com/MattAndDev/3n16m4-m4ch1n3#readme","_id":"3n16m4-m4ch1n3@0.0.1","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Cai8CIqCkiscH+++gRxvoES4FrYE8N5Jun4yc2u+9VbMap1ZLQgxXk89lkhRq3vL0rBhxZTywrMjc+h9PUPHbQ==","shasum":"8271ec7504036a99fbf280c60116ae2a9849af66","tarball":"https://registry.npmjs.org/3n16m4-m4ch1n3/-/3n16m4-m4ch1n3-0.0.1.tgz","fileCount":25,"unpackedSize":168633,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQr0WCRA9TVsSAnZWagAAIL0P/3eKbeRmmVG3lzgg6lwH\nfWiHBz+qwKMT8bd+NtEgJhdq1rQKoquSDxim+QSIk/PbOccPQacTavDfLCiF\nLE08s/WBsx9d+uh69PMbYMqjgPP51nAYjB438EhPAuxsSFzlX8HkpXeutiiZ\n+U6Xt2fKEwDH3+f0N877FJK1w03I73/VxwDdnjB8cRoNBgHwwd16+aWzXDPW\nIoZyQIf53g3aFlVa6CNUdo68iu1IGy4tANrTFeTX87HbYltCwb6jaL+aG4AW\nHCezthzMF/vtsabnIxysCF191bQCit6NpApzOWW8l2LRunuKs/ufevPkMOVj\n9tj0ULCkMU2v5otKi+t0s7gbPNfB0uM3YrPkUOWkKZmAdRulMy5ESuPGCH8A\nb8eRlrLYVe9o8uM1aozt0yYatgKt+/mkxDVLLyB8JkirSvZ1odYsQBkxn5Ad\nAqUw2UvyNVBcrmFcMu4DV29UElJbGwp4SWKEJ/WFZ7DbFFugy+mInxcjQCFV\n7vXbQV7qF4JWzTu22Qjo/C6c0kuRJuvOiaYNP8K0zyqpKCG0ozP9vI2uy/62\nzXtUI+pt4WQqqQwMjNeUuh9Q/IvCT68cRg7h3xyoxVngNvWMrO0MJjHXwX/J\nAcdEVymb0W92WrpcCMmfRZ2UfsjL7B3Pl6MF0tJVGBI9PlzsIfuFyJBCb5cn\nN7Jd\r\n=Ugmd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwyuwnjHBfujBAfgO5FnaBhFOwM5lnhs110eiE4U2DeQIgK9pxc89hZv8jRUBnz7pHeHlcEfk03923+kB6v0/iyBs="}]},"maintainers":[{"name":"mattanddev","email":"mail@matteo.land"}],"_npmUser":{"name":"mattanddev","email":"mail@matteo.land"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3n16m4-m4ch1n3_0.0.1_1598209302309_0.6747393339712029"},"_hasShrinkwrap":false},"0.0.2":{"name":"3n16m4-m4ch1n3","version":"0.0.2","description":"A modern interpretation of the infamous enigma machine","main":"lib/3n16m4-m4ch1n3.commonjs.js","types":"source/index.ts","module":"lib/3n16m4-m4ch1n3.esm.js","bin":{"3n16m4-m4ch1n3":"bin/3n16m4-m4ch1n3.js"},"repository":{"url":"git+https://github.com/MattAndDev/3n16m4-m4ch1n3.git"},"scripts":{"start":"nodemon --watch 'source/**/*.ts' --exec 'ts-node' source/dev.ts","bundle":"npx rollup -c rollup.config.js","prepublishOnly":"npm run bundle","test":"jest ./source/*","test:watch":"jest --watch ./source/*","pretty:lint":"prettier ./**  --write && eslint ./source --ext .ts --fix"},"keywords":[],"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/jest":"^26.0.23","@types/minimist":"^1.2.1","@types/node":"^15.3.0","@types/seedrandom":"^3.0.0","@typescript-eslint/eslint-plugin":"^4.23.0","@typescript-eslint/parser":"^4.23.0","eslint":"^7.26.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^24.3.6","eslint-plugin-prettier":"^3.4.0","husky":"^6.0.0","jest":"^26.6.3","lint-staged":"^11.0.0","nodemon":"^2.0.7","prettier":"^2.3.0","rollup":"^2.48.0","rollup-plugin-add-shebang":"^0.3.1","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^26.5.6","ts-loader":"^9.1.2","ts-node":"^9.1.1","tslib":"^2.2.0","typescript":"^4.2.4"},"author":{"name":"Matteo Maroanati","email":"mail@matteo.land","url":"https://matteo.land"},"license":"WTFPL","husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"**/*.ts":["prettier --write","eslint ./source --ext .ts --fix"]},"dependencies":{"minimist":"^1.2.5","seedrandom":"^3.0.5"},"gitHead":"c95ead396d8c6571eeccaf3f66dd19514c7db451","bugs":{"url":"https://github.com/MattAndDev/3n16m4-m4ch1n3/issues"},"homepage":"https://github.com/MattAndDev/3n16m4-m4ch1n3#readme","_id":"3n16m4-m4ch1n3@0.0.2","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-n0DuOeWk0t4pIgchIX8c5qw1ILs6Uv4ii4lDoap1xccOt2eft6CXYYa9F4maIyB0zaQyksl1vjJRYacSPeqWIA==","shasum":"d4de451650025aa39498c5d271cc71a072c20bd8","tarball":"https://registry.npmjs.org/3n16m4-m4ch1n3/-/3n16m4-m4ch1n3-0.0.2.tgz","fileCount":25,"unpackedSize":167761,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgn8q3CRA9TVsSAnZWagAAb20P/1LXPcYNw/flY6xJX2E/\nsxXOs+gpFvo691Oer2SHdK9xB8a2aZWIrBrZarc4aNQn4t7bOwnER2Y9QcOf\nDjg+Ytq2pJprgwMCYapnYuSfmo4qn6lpMMF2awKIPpp3sM0LPCTZf9VfFDU3\nRlchKvIOjZlZ0Y13UPHIjDq+WhaF6XCluqSUeV6wFjzfXPKOLcdZt13y39Rx\nQxClJo4UmnGcPTMXUxspE0lIwzB6Yr/vaEHUQouSmZxFPHDyvRUNfqKf+lFJ\nEwKIJfN/HS5t8Yif1WB97+vE1JaVdKaLViTgGjRshAmEyrUg+pdTOOx4+KoX\n80KDkf+6J+Th59OjMpbLGklcUjfNFVhsSJoSyx06EFJDiTtqF0OwpibE97Hy\nhcTDp/dr8+twPCfhzcOFReN4lE1moGPpQYFpk8E3jXF30vPIlR86JFC7SS7a\nFneFSx4Ss9gO7f1UiwsoyIi0DIwSOHuq0oVkeqg9CoNzZgmyczMsliNsgGVr\nI/7sXEJPe4bjIiX7tGs0ruZ+GPYU341oj//wp4pcedD8IDTfbyNjECYPRycU\nWho5B/uXjZqp3lTC37GMnmv370JX5d1nyqhu87sGHTun+DbkGvuYICq7lbO6\nToXW7QuAvbo5ORNeMFvCTJf2LO6W4xax5IIxUb6AycjMl/qgJQGHifyv8SBs\nm7CR\r\n=VAfN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZCA/14OWQjgKyNO5MPcQk9SX4WHrBSxWAPPbHvB+J3AiBOjfTP9FBeiK6O9fma6HEG9znHSCbb67QYHJDt5FfSpw=="}]},"_npmUser":{"name":"mattanddev","email":"mail@matteo.land"},"directories":{},"maintainers":[{"name":"mattanddev","email":"mail@matteo.land"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3n16m4-m4ch1n3_0.0.2_1621084854799_0.5976422716199461"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-23T19:01:42.309Z","0.0.1":"2020-08-23T19:01:42.418Z","modified":"2022-04-04T10:21:44.975Z","0.0.2":"2021-05-15T13:20:55.050Z"},"maintainers":[{"name":"mattanddev","email":"mail@matteo.land"}],"description":"A modern interpretation of the infamous enigma machine","homepage":"https://github.com/MattAndDev/3n16m4-m4ch1n3#readme","keywords":[],"repository":{"url":"git+https://github.com/MattAndDev/3n16m4-m4ch1n3.git"},"author":{"name":"Matteo Maroanati","email":"mail@matteo.land","url":"https://matteo.land"},"bugs":{"url":"https://github.com/MattAndDev/3n16m4-m4ch1n3/issues"},"license":"WTFPL","readme":"# 3n16m4-m4ch1n3\n\nA modern interpretation of the infamous [enigma machine](https://en.wikipedia.org/wiki/Enigma_machine) not limited by hardware and wiring.\n\nFor an accurate re-implementation of the original machine, see the [amazing work by Daniel Palloks](http://people.physik.hu-berlin.de/~palloks/js/enigma/index_en.html)\n\n## Default state\n\n```js\nconst DEFAULT_CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ .'.split('')\n\nconst DEFAULT_ROTORS = [\n  { index: 1, id: 1 },\n  { index: 1, id: 2 },\n  { index: 1, id: 3 },\n]\n\nconst DEFAULT_PLUGBOARD = null\n```\n\n## cli\n\nYou can use the machine in your cli:\n\n```shell\nnpm i -g 3n16m4-m4ch1n3\n3n16m4-m4ch1n3 -m \"HELLO WORLD\"\n```\n\nwill output: `BIMSUK .VOO`\n\nif you:\n\n```\n3n16m4-m4ch1n3 -m \"BIMSUK .VOO\"\n```\n\nyou'll get: `HELLO WORLD`\n\nmagic ✨\n\n### cli options\n\n`-m`: required, message to be encoded\n\n`-r`: rotors in format \"id-index id-index\"\n\n`-c`: charset as quoted string \"CHARSET\"\n\n`-p`: plugboard in format \"char-char char-char\"\n\n`-v`: print updated rotor state\n\nExample:\n\n```\n3n16m4-m4ch1n3 \\\n-r \"1-25 2-12 3-25\" \\\n-c \"qwertyuiopasdfghjklzxcvbnm .\" \\\n-p \"e-l o-h\" \\\n-m \"hello world\"\n```\n\noutputs: `v abuitdyny`\n\nOf course then:\n\n```\n3n16m4-m4ch1n3 \\\n-r \"1-25 2-12 3-25\" \\\n-c \"qwertyuiopasdfghjklzxcvbnm .\" \\\n-p \"e-l o-h\" \\\n\"v abuitdyny\"\n```\n\noutputs: `hello world`\n\n## module\n\nThe package exports a single function `machine`, you can use it as follows:\n\n```js\nimport { machine } from '3n16m4-m4ch1n3'\n\nconst { encodedMessage, rotors } = machine({\n  message: 'HELLO WORLD',\n})\n```\n\nYou can optionally pass `rotors`, custom `charset` and `plugboard`.\nSee type definition for details.\n\n## Dependencies\n\nThis package requires crypto (required by [seedrandom](https://www.npmjs.com/package/seedrandom))\n\n## Implementation details\n\nAs this package offers a HUGE variety of configurations (far more than the original machines), generating all possible configuration ahead of time would have required a limitation on charset choices as well as number of rotors.\n\nInstead it uses a seeded random via [seedrandom](https://github.com/davidbau/seedrandom), based on machine configuration to create the rotor mappings at runtime.\n\nThis allows for a huge variety of possible configurations.\n\nThis is **not** an **exact** replica of the inner working of any enigma machine version, rather an approximation that expands on the possible number of configurations.\n\n### Notable differences to original design\n\n- A letter can become itself\n- Character set is not limited to 26 latin chars\n- Lowercase and uppercase characters are not the same\n- Used rotor number is not limited to 3\n- Choice of available rotors is not limited to 7\n- Plugboard expands with character set\n","readmeFilename":"readme.md"}