Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hiddencoder

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hiddencoder - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

example/decode.js

2

package.json
{
"name": "hiddencoder",
"version": "1.0.2",
"version": "1.0.3",
"description": "Encode ASCII strings into zero-width unicode characters, and decode back into ASCII",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -15,8 +15,23 @@ # Hiddencoder

const hiddenString = a2h("Hidden message");
const hiddenString = a2h("Hidden string");
console.log(`Hidden: ${hiddenString}`);
console.log(`Shown: ${h2a(hiddenString)}`);
console.log(`Actual: ${h2a(hiddenString)}`);
// Output:
// Hidden: 󠀇󠁀󠀵󠀵󠀶󠁅󠄳󠁄󠀶󠁐󠁐󠀲󠀸󠀶
// Shown: Hidden message
// Actual: Hidden message
```
### Example usage:
Use the [example files](examples/) to encode a file in order to hide its content:
Encode the code in [`encode.js`](examples/encode.js) file by using it on itself
```Bash
node encode.js encode.js
```
This will save the encoded output into [`encode.js.enc`](examples/encode.js.enc), and will seem empty
Decode the content back into readable form by using [`decoder.js`](examples/decoder.js)
```Bash
node decode.js encode.js.enc
```
This will save the decoded output into [`encode.js.enc.dec`](examples/encode.js.enc.dec)

@@ -10,8 +10,9 @@ /*

for (const c of alphabet) {
const charPoint = initValue - c.codePointAt(0);
let u = charPoint < 0 ? 'C' : 'D';
const val = '' + Math.abs(charPoint);
const charPoint = c.codePointAt(0);
const pointDiff = initValue - c.codePointAt(0);
let u = pointDiff < 0 ? 'C' : 'D';
const val = '' + Math.abs(pointDiff);
u += (val.length < 2 ? '0' : '') + val
CODES[c] = unescape(u);
CODES[unescape(u)] = c;
CODES[charPoint] = unescape(u);
CODES[unescape(u)] = charPoint;
}

@@ -26,3 +27,3 @@

for (const c of inputAscii) {
output += unescape(hidingChars + CODES[c]);
output += unescape(hidingChars + CODES[c.codePointAt(0)]);
}

@@ -41,3 +42,3 @@ return output

if (!c) continue;
output += CODES[c];
output += String.fromCodePoint(CODES[c]);
}

@@ -44,0 +45,0 @@ return output;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc