Skip to content

Commit

Permalink
fixed the problems with git
Browse files Browse the repository at this point in the history
  • Loading branch information
samolukadjo committed Sep 18, 2024
1 parent 5af23f5 commit c545bb5
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
1 change: 0 additions & 1 deletion wungle-extension/3y3
Submodule 3y3 deleted from b01edc
34 changes: 34 additions & 0 deletions wungle-extension/lib/3y3.js
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);
};
19 changes: 19 additions & 0 deletions wungle-extension/lib/README.md
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)
}
}
```
2 changes: 1 addition & 1 deletion wungle-extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"content_scripts": [
{
"matches": ["*://*.tumblr.com/*"],
"js": ["3y3/3y3.js", "content_script.js"]
"js": ["lib/3y3.js", "content_script.js"]
}
],
"browser_action": {
Expand Down

0 comments on commit c545bb5

Please sign in to comment.