0.0.2 • Published 3 years ago

specky-endecode v0.0.2

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

Specky Endecode

Installation

npm i specky-endecode

Usage

const endecode = require('specky-endecode');
const text = 'It will never get encoded.';  // dead meme
const encoded = endecode(text);             // K( ).€k IY"gg P%1 Rka#0;-T
const decoded = endecode(encoded);          // It will never get encoded.

const options = {
    characters: 'abcd', // has to be an even number of characters
    whitespaces: '\s\r\n',
    log: true,
};

const withOptions = endecode('abacaba', options); // bcdabcb

Notes

The supported characters by default are the following:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()[]{}!\"§$%&/=?`´*-+<>\\#'_^°~,.;:|@€

Flaws

This system obviously has flaws, here are some I found:

  • a character can't get output as itself
  • if a character gets swapped with it's output, the characters after that won't get shuffled
  • newlines and spaces don't change the outcome

Benchmark (endecoded twice)

String LengthTime
11ms
102ms
1007ms
100024ms
10000103ms
100000903ms
10000009265ms
10000000105133ms
100000000OOM Error
0.0.1

3 years ago

0.0.2

3 years ago

0.0.0

3 years ago