salis_shifrator
v1.0.0
Published
text shifrator
Readme
Text string encoder and decoder
Install
npm install salis_shifratorAdd to your code
const shifrator = require("salis_shifrator");Use
Encode
For encode text use encodeText function param {string} text - text in string format (first argument) param {string} encodFormula - Formula in text form. After each symbol you need to put a space, for example ( x + 2 ) _ 2 or ( x + 22 ) _ 2 (second argument) returns Returns an array of numbers
Example:
const testFormula = "( x + 2 ) * 2"
const testText = "Hello world";
console.log(encodeText(testText, testFurmula));
Decode
For decode text use decodeText function param {Number} arr - An array of numbers encoded in the decodeText function param {string} decodeFormula - Formula in text form. After each symbol you need to put a space, for example ( x + 2 ) _ 2 or ( x + 22 ) _ 2. If the encoding was according to the formula, for example ( x + 2 ) * 2, then the decoding should be according to the formula ( x / 2 ) - 2 returns Decoded text
const testFormula = "( x / 2 ) - 2";
const testEncodeText = [
420, 316, 420, 384, 422, 290, 68, 420,
386, 420, 372, 420, 386, 420, 372, 422,
262, 422, 284, 420, 376, 420, 356, 68,
420, 384, 422, 274, 420, 366, 420, 382,
422, 284, 68, 420, 358, 420, 384, 420,
378, 422, 284, 422, 276, 420, 356, 422,
290
];
console.log(decodeText(testEncodeText, testFurmula));
Attention! This is an test version and I don't know if I will continue to develop this encoder. It depends on whether it will be useful to someone.
