hiddencoder
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
6266
8
61
36
0
2