rot13-cipher
Version:
ROT13 substitution cipher for Node.js
40 lines (24 loc) • 1.01 kB
Markdown
//en.wikipedia.org/wiki/ROT13) substitution cipher for Node.js. Example: `foobar` → `sbbone`<br>
ROT13 is its own [inverse](https://en.wikipedia.org/wiki/Inverse_function). Meaning, to undo `ROT13`, the same algorithm is applied, so the same action can be used for encoding and decoding.<br>
```bash
$ npm install rot13-cipher
```
```js
const rot13Cipher = require('rot13-cipher');
rot13Cipher('hello world');
//=> 'uryyb jbeyq'
rot13Cipher('foo123bar');
//=> 'sbb123one'
rot13Cipher('foo!@bar')
//=> 'sbb!@one'
rot13Cipher('uryyb jbeyq')
//=> 'hello world'
```
Takes one string input and returns the encoded veersion of it.
<a href="https://www.buymeacoffee.com/7BdaxfI"><img src="https://user-images.githubusercontent.com/33410545/95193575-a3b51b00-07f1-11eb-9bbb-90ea2e1018d7.png" height="50px"/></a>
> [`ROT13`](https: