An open API service indexing awesome lists of open source software.

https://github.com/milio48/nk26

NKosec Encode, 2 side encode. change alphabet to numeric or back numeric to alphabet.
https://github.com/milio48/nk26

Last synced: 19 days ago
JSON representation

NKosec Encode, 2 side encode. change alphabet to numeric or back numeric to alphabet.

Awesome Lists containing this project

README

        

# nk26
Nkosec Encode, 2 side encode. change alphabet to numeric or back numeric to alphabet.

### nk26 logic

- focused on alphanumeric, use a simple logic str_replace.
- this logic is made, when I make a challenge for a friend in a detective game.

### php example
```
{
const index = a.indexOf(char);
return index !== -1 ? b[index] : char;
}).join('');
}

function nk26_decode(data) {
const replacements = [
{ from: ['1112', '1113', '0'], to: ['y', 'z', ' '] },
{ from: ['112', '113', '114', '115', '116', '117', '118', '119'], to: ['q', 'r', 's', 't', 'u', 'v', 'w', 'x'] },
{ from: ['12', '13', '14', '15', '16', '17', '18', '19'], to: ['i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'] },
{ from: ['2', '3', '4', '5', '6', '7', '8', '9'], to: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] }
];

replacements.forEach(replacement => {
replacement.from.forEach((item, index) => {
data = data.split(item).join(replacement.to[index]);
});
});

return data;
}

// Example
const encoded = nk26_encode("HELLO THERE".toLowerCase());
console.log(encoded); // Output: 961515180115961136

const decoded = nk26_decode("961515180115961136");
console.log(decoded); // Output: hello there
```