-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5af23f5
commit c545bb5
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
Submodule 3y3
deleted from
b01edc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const encode = (/**@type {string}*/ text) => { | ||
const codePoints = [...text].map((c) => c.codePointAt(0)); | ||
|
||
const output = []; | ||
for (const char of codePoints) { | ||
output.push( | ||
String.fromCodePoint( | ||
char + (0x00 < char && char < 0x7f ? 0xe0000 : 0) | ||
).toString() | ||
); | ||
} | ||
|
||
return output.join(""); | ||
}; | ||
|
||
const decode = (/**@type {string}*/ text) => { | ||
const codePoints = [...text].map((c) => c.codePointAt(0)); | ||
|
||
const output = []; | ||
for (const char of codePoints) { | ||
output.push( | ||
String.fromCodePoint( | ||
char - (0xe0000 < char && char < 0xe007f ? 0xe0000 : 0) | ||
).toString() | ||
); | ||
} | ||
|
||
return output.join(""); | ||
}; | ||
|
||
const detect = (/**@type {string}*/ text) => { | ||
const codePoints = [...text].map((c) => c.codePointAt(0)); | ||
return codePoints.some((c) => 0xe0000 < c && c < 0xe007f); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 3y3 | ||
Hide text in plain sight, using invisible characters. | ||
|
||
# Credit | ||
Credit goes to [@yourcompanionAI](https://github.com/twilight-sparkle-irl), source: https://synthetic.garden/3y3.htm | ||
|
||
I only re-implemented their algorithm into easy-to-use encode/decode functions. <br /> | ||
Below is the original source code: | ||
```js | ||
function secondsightify(t) { | ||
if ([...t].some(x => (0xe0000 < x.codePointAt(0) && x.codePointAt(0) < 0xe007f))) { | ||
// 3y3 text detected. Revealing... | ||
return (t => ([...t].map(x => (0xe0000 < x.codePointAt(0) && x.codePointAt(0) < 0xe007f) ? String.fromCodePoint(x.codePointAt(0) - 0xe0000) : x).join("")))(t) | ||
} else { | ||
// No 3y3 text was found, Encoding... | ||
return (t => [...t].map(x => (0x00 < x.codePointAt(0) && x.codePointAt(0) < 0x7f) ? String.fromCodePoint(x.codePointAt(0)+0xe0000) : x).join(""))(t) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters