├── LICENSE ├── README.md ├── alkencode.js ├── index.html └── maxlist.html /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 no-passwd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # alien encode(alkencode) 2 | 3 | Language: [中文](#) | [English](https://github-com.translate.goog/no-passwd/alkencode?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp) 4 | 5 | Alien Encode(外星人编码),可以将 UTF-8 字符编码为像数据损坏后的格式,比如: 6 | 7 | > ▞▙▞▚▘▌▚▖▞▖▞▚▘▄▚▙▄▘▘▚▄▚▗█ 8 | 9 | 10 | ![images](https://github.com/no-passwd/alkencode/assets/143941593/478db169-7853-4474-8e74-594c7c5e8f03) 11 | 12 | 我觉得这个方式很有趣 13 | 14 | --- 15 | 16 | ## Features 17 | 18 | - UTF-8 编码:Alien Encode 可以把任意UTF-8 字符映射为像这种乱码“▞▗▘▚▄▜▄▚”的形式(包括utf8表情符号😀)。 19 | - 抗干扰性:编码后可以在编码后插入然后**英文**或者**gb2312**(中文)而依然可以解码,具有插入干扰具有抵抗力。 20 | 21 | 22 |
23 | 24 | 25 | 像这样: 26 | 27 | 28 | ~~[在线试试](https://no-passwd.github.io/alkencode/)~~ 29 | 30 | --- 31 | 32 | > 新的,宽文本框由kikuri提供思路 33 | [在线试试](https://no-passwd.github.io/alkencode/maxlist.html) 34 | 35 | #### 英文插入 36 | 37 | ```python 38 | I am lost▞▄▘▚▄▀▄▟I'm really really▘▙▘▚▘▄▚▗▄▝▞▚▞▄lost▚▞▘▙▘▀▄▘▚▎▄▖▘▚▚▚▄▚▞▙▞▀▞▖▗▎▞and i don't know▙▞▚▘▌▚▖▘▙ how to get back▘▞▞▄▄▀▄▗▄▌▞▖▄▃▘▙▘▚▄▟help▚▞▘▙▘▘▘▙▚me!▚▘█▚▛▄and,I h▚▚▞ 39 | ``` 40 | 41 | #### 中文插入 42 | 43 | ```python 44 | 告诉你吧▗▞▄▃▄世界▙▞▖▗▞我不▚▎▄相▙▚▄信▗▞!▄▝我不相▞▗信天是蓝的▄▌▗▞▞▙我不相信▘▜▗▚▗▄▞报应▙▘▗▗▀ 45 | ``` 46 | 47 | 以上粘贴到“crypttext(密文区)”点击“decrypt(解密)”依然可以正常解密。 48 | 49 |
50 | 51 | --- 52 | 53 | 54 | ## Usage 55 | 56 | 要使用 Alien Encode,可以这样使用: 57 | 58 | 1. 克隆仓库: 59 | 60 | ```bash 61 | git clone https://github.com/no-passwd/alkencode.git 62 | ``` 63 | 64 | 2. 引入js文件: 65 | 66 | ```js 67 | 68 | ``` 69 | 70 | 3. 现在可以使用加密和解密函数了: 71 | 72 | ```js 73 | function encrypt() { 74 | let input = document.getElementById("inputText"); 75 | let output = document.getElementById("outputText"); 76 | output.value=kencode(input.value); 77 | /**Encode this*/ 78 | } 79 | 80 | function decrypt() { 81 | let input = document.getElementById("inputText"); 82 | let output = document.getElementById("outputText"); 83 | input.value=dekencode(output.value); 84 | /**Decode this*/ 85 | } 86 | ``` 87 | 88 | 参考index.html示例 89 | 90 | 或者直接引入 91 | 92 | `https://cdn.jsdelivr.net/gh/no-passwd/alkencode@main/alkencode.js` 93 | 94 | ```js 95 | 99 | ``` 100 | 101 | 102 | --- 103 | 104 | 105 |
106 | 107 | ## Notice 108 | 109 | 抗干扰性使用正则匹配过滤,在正则之外可能出现未知错误。 110 | 111 | --- 112 | 113 |
114 | 115 | ## Contributing 116 | 117 | 欢迎对 Alien Encode 的贡献,目前需要以下方面: 118 | 119 | ~~1.优化alkencode.js的正则匹配,使其匹配除了**英文**或者**gb2312**的其他编码。~~,已解决,感谢ymh1147提供思路。 120 | 121 | 2.翻译index.html为其他语言(目前只支持中文/英文)。 122 | 123 | --- 124 | 125 |
126 | 127 | ## LICENSE 128 | 129 | Alien Encode 使用 [MIT 许可证](LICENSE) 进行许可。您可以根据许可证的条款自由使用、修改和分发该程序。 130 | 131 | --- 132 | 133 |
134 | 135 | ## Thanks 136 | 137 | 这个项目的灵感来自这个网站: 138 | 139 | `https://strangers.atrocityland.com/enter/site/deadends/deadend_iamlost.html` 140 | 141 | 我遇到这个网站觉得它的的乱码表示很有趣,然而我却读不懂它的编码。 142 | 143 | 查了一圈,发现这个编码本身没有意义,仅仅是用来表示单词传输过程发送了损坏,表示乱码的。 144 | 145 | 之后我突然想到我可以给她(乱码)赋予意义的。 146 | 147 | -------------------------------------------------------------------------------- /alkencode.js: -------------------------------------------------------------------------------- 1 | /** MIT LICENSE by no-passwd https://github.com/no-passwd */ 2 | /* Writen In 1/23/2024 */ 3 | 4 | /*其他utf8正则,thanks @ymh1147*/ 5 | var chineseRegex = /[\u4E00-\u9FA5\u3040-\u309F\u30A0-\u30FF\u31F0-\u31FF\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\u002E\u3002\uFF0C\uFF1F\uFF01\u3001\uFF1B\uFF1A\u2018\u2019\u201C\u201D\u300A\u300B\uFF08\uFF09\u3010\u3011\u2014\u2015\uD83C\uDC00-\uD83D\uDFFF\uFE0F]/gu; 6 | 7 | /*抗干扰,滤除ascii码*/ 8 | function replaceEnglish(str) { 9 | var regex = /[a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@[\]^_{|}~]/g; 10 | return str.replace(regex, ""); 11 | } 12 | 13 | /*抗干扰,滤除常见utf8码*/ 14 | function replaceChinese(str) { 15 | return str.replace(chineseRegex, ""); 16 | } 17 | 18 | 19 | const kencode = (str) => { 20 | /* 将字符串转换为UTF-8字节数组 */ 21 | const utf8Bytes = new TextEncoder().encode(str); 22 | let utf8String = ''; 23 | for (let i = 0; i < utf8Bytes.length; i++) { 24 | utf8String += String.fromCharCode(utf8Bytes[i]); 25 | } const utf8str = btoa(utf8String);let resfk = utf8str.split('').map((char) => char.charCodeAt(0)).map((byte) => byte.toString(16).padStart(2, '0')).join(''); 26 | return resfk.replaceAll('\x31', '\u259D').replaceAll('\x32', '\u2596').replaceAll('\x33', '\u2597').replaceAll('\x34', '\u2598').replaceAll('\x35', '\u259E').replaceAll('\x36', '\u2584').replaceAll('\x37', '\u259A').replaceAll('\x38', '\u2580').replaceAll('\x39', '\u2599').replaceAll('\x61', '\u259B').replaceAll('\x62', '\u259C').replaceAll('\x63', '\u259F').replaceAll('\x64', '\u2588').replaceAll('\x65', '\u258C').replaceAll('\x66', '\u2583').replaceAll('\x30', '\u258E'); 27 | } 28 | 29 | const dekencode = (str) => { 30 | /*抗干扰,过滤插入的未编码字符串 */ 31 | let kcode= replaceChinese(replaceEnglish(str)).replaceAll(' ',"").replaceAll('\u259D','\x31').replaceAll('\u2596','\x32').replaceAll('\u2597','\x33').replaceAll('\u2598','\x34').replaceAll('\u259E','\x35').replaceAll('\u2584','\x36').replaceAll('\u259A','\x37').replaceAll('\u2580','\x38').replaceAll('\u2599','\x39').replaceAll('\u259B','\x61').replaceAll('\u259C','\x62').replaceAll('\u259F','\x63').replaceAll('\u2588','\x64').replaceAll('\u258C','\x65').replaceAll('\u2583','\x66').replaceAll('\u258E','\x30'); 32 | /* 将utf8char数组转换为UTF-8字符串 */ 33 | const utf8char = []; 34 | for (let i = 0; i < kcode.length; i += 2) { 35 | utf8char.push(parseInt(kcode.substr(i, 2), 16)); 36 | } 37 | const bytke = new Uint8Array(atob(String.fromCharCode.apply(null, utf8char)).split('').map(char => char.charCodeAt(0))); 38 | let kfser = new TextDecoder().decode(bytke); 39 | return kfser; 40 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | alkencode 5 | 6 | 53 | 54 | 70 | 71 | 72 | 75 |

76 | 77 |

78 | 79 |

80 | 81 | 82 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /maxlist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | alkencode 5 | 6 | 53 | 54 | 70 | 71 | 72 | 75 |

76 | 77 |

78 | 79 |

80 | 81 | 82 | 84 | 85 | 86 | --------------------------------------------------------------------------------