Skip to content

Commit 5bbd7c3

Browse files
committed
Added codecs: hazz15, megan35
1 parent 21e6ba7 commit 5bbd7c3

6 files changed

Lines changed: 101 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,11 @@ This category also contains `ascii85`, `adobe`, `[x]btoa`, `zeromq` with the `ba
470470
- [X] `esab46`: aka ESAB-46 (Base64 with a shuffled alphabet, from online JavaScript tools)
471471
- [X] `feron74`: aka FERON-74 (Base64 with a shuffled alphabet, from online JavaScript tools)
472472
- [X] `gila7`: aka GILA7 (Base64 with a shuffled alphabet, from online JavaScript tools)
473+
- [X] `hazz15`: aka HAZZ-15 (Base64 with a shuffled alphabet, from online JavaScript tools)
473474
- [X] `hindia-4x`: aka HINDIA-4X (URI-encoded text substituted by Bengali and Devanagari characters, from online JavaScript tools)
474475
- [X] `japoo-c2s`: aka JAPOO-C2S (URI-encoded text substituted by Chinese and Japanese characters, from online JavaScript tools)
475476
- [X] `korex-3s`: aka KOREX-3S (URI-encoded text substituted by Korean characters, from online JavaScript tools)
477+
- [X] `megan35`: aka MEGAN-35 (Base64 with a shuffled alphabet, from online JavaScript tools)
476478
- [X] `tigo-3fx`: aka TIGO-3FX (Base64 with a shuffled alphabet, from online JavaScript tools)
477479
- [X] `tripo-5`: aka TRIPO-5 (Base64 with a shuffled alphabet, from online JavaScript tools)
478480
- [X] `zong22`: aka ZONG22 (Base64 with a shuffled alphabet, from online JavaScript tools)

‎docs/pages/enc/obfuscation.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,23 @@ This toy encoding comes from online JavaScript encryption tools. Like [ATOM-128]
142142

143143
-----
144144

145+
### HAZZ-15
146+
147+
This toy encoding comes from online JavaScript encryption tools. It is Base64 with a shuffled alphabet, whose 65th character (`5`) is used for padding. As in the original JavaScript, the text is first escaped with JavaScript's `escape()` (e.g. a whitespace becomes `%20`), and unescaped after decoding ; encoded texts made from the UTF-8 bytes of the text (without escaping) are decoded as well.
148+
149+
**Codec** | **Conversions** | **Aliases** | **Comment**
150+
:---: | :---: | --- | ---
151+
`hazz15` | text <-> HAZZ-15 encoded text | `hazz-15`, `hazz_15` |
152+
153+
```python
154+
>>> codext.encode("this is a test", "hazz15")
155+
'3m7Vqbzb+mFdjgiGv0zb+6fFq=y5'
156+
>>> codext.decode("3m7Vqbzb+mFdjgiGv0zb+6fFq=y5", "hazz-15")
157+
'this is a test'
158+
```
159+
160+
-----
161+
145162
### HINDIA-4X
146163

147164
This toy encoding comes from online JavaScript encryption tools. The pairs of letters `oo`, `ii`, `ee`, `tt` and `rr` are first replaced by other characters, then the text is encoded like JavaScript's `encodeURIComponent()` does and its characters, in reverse order, are each substituted by a Bengali or Devanagari character, a space being inserted every 4 characters and the encoded text ending with `ভ`.
@@ -197,6 +214,23 @@ This toy encoding comes from online JavaScript encryption tools. The text is enc
197214

198215
-----
199216

217+
### MEGAN-35
218+
219+
This toy encoding comes from online JavaScript encryption tools. It is Base64 with a shuffled alphabet, whose 65th character (`5`) is used for padding. As in the original JavaScript, the text is first escaped with JavaScript's `escape()` (e.g. a whitespace becomes `%20`), and unescaped after decoding ; encoded texts made from the UTF-8 bytes of the text (without escaping) are decoded as well.
220+
221+
**Codec** | **Conversions** | **Aliases** | **Comment**
222+
:---: | :---: | --- | ---
223+
`megan35` | text <-> MEGAN-35 encoded text | `megan-35`, `megan_35` |
224+
225+
```python
226+
>>> codext.encode("this is a test", "megan35")
227+
'nLX0msesRL1tOdNqicesRM=1mxb5'
228+
>>> codext.decode("nLX0msesRL1tOdNqicesRM=1mxb5", "megan-35")
229+
'this is a test'
230+
```
231+
232+
-----
233+
200234
### TIGO-3FX
201235

202236
This toy encoding comes from online JavaScript encryption tools. It is Base64 with a shuffled alphabet, whose 65th character (`X`) is used for padding. As in the original JavaScript, the text is first escaped with JavaScript's `escape()` (e.g. a whitespace becomes `%20`), and unescaped after decoding ; encoded texts made from the UTF-8 bytes of the text (without escaping) are decoded as well.

‎src/codext/obfuscation/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
from .esab46 import *
88
from .feron74 import *
99
from .gila7 import *
10+
from .hazz15 import *
1011
from .hindia4x import *
1112
from .japooc2s import *
1213
from .korex3s import *
14+
from .megan35 import *
1315
from .tigo3fx import *
1416
from .tripo5 import *
1517
from .zong22 import *

‎src/codext/obfuscation/_jsbase64.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: UTF-8 -*-
22
"""Base64 variants, shared by the toy encodings of online JavaScript encryption tools (ATOM-128, ESAB-46, FERON-74,
3-
GILA7, TIGO-3FX, TRIPO-5, ZONG22).
3+
GILA7, HAZZ-15, MEGAN-35, TIGO-3FX, TRIPO-5, ZONG22).
44
55
These encodings are Base64 with a shuffled alphabet of 65 characters, whose last one is used for padding. As in the
66
original JavaScript, the text is first escaped with JavaScript's escape() (e.g. " " becoming "%20" and "é" becoming

‎src/codext/obfuscation/hazz15.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: UTF-8 -*-
2+
"""HAZZ-15 Codec - HAZZ-15 content encoding.
3+
4+
HAZZ-15 is a toy encoding found on online JavaScript encryption tools. It is Base64 with a shuffled alphabet, whose
5+
65th character ("5") is used for padding. As in the original JavaScript, the text is first escaped with JavaScript's
6+
escape() (e.g. " " becoming "%20" and "é" becoming "%E9"), and unescaped after decoding ; encoded texts made without
7+
this escaping (i.e. from the UTF-8 bytes of the text, e.g. by https://gist.github.com/tunelko/49b7e64c1688d62d0ecd)
8+
are decoded as well, except that an ASCII text holding escape sequences (e.g. "%41") is then unescaped.
9+
10+
This codec:
11+
- en/decodes strings from str to str
12+
- en/decodes strings from bytes to bytes
13+
- decodes file content to str (read)
14+
- encodes file content from str to bytes (write)
15+
16+
Reference: https://gist.github.com/tunelko/49b7e64c1688d62d0ecd
17+
"""
18+
from ._jsbase64 import js_base64
19+
from ..__common__ import add
20+
21+
22+
__examples__ = {
23+
'enc(hazz15|hazz-15|hazz_15)': {'this is a test': '3m7Vqbzb+mFdjgiGv0zb+6fFq=y5', 'test': '3mAd3H55', '': ''},
24+
'dec(hazz15)': {'3mAd3H55': 'test', '3mAd3H5': None, '3mAd@H55': None},
25+
'enc-dec(hazz15)': ['this is a test', 'Hello, World! 1234', '\xe9t\xe9 \u2603 \U0001f600', '100% sure', 'a'],
26+
}
27+
__guess__ = ["hazz15"]
28+
29+
30+
add("hazz15", *js_base64("hazz15", "HNO4klm6ij9n+J2hyf0gzA8uvwDEq3X1Q7ZKeFrWcVTts/MRGYbdxSo=ILaUpPBC5"),
31+
r"^hazz[-_]?15$", printables_rate=1., expansion_factor=(1.6, .3))

‎src/codext/obfuscation/megan35.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: UTF-8 -*-
2+
"""MEGAN-35 Codec - MEGAN-35 content encoding.
3+
4+
MEGAN-35 is a toy encoding found on online JavaScript encryption tools. It is Base64 with a shuffled alphabet, whose
5+
65th character ("5") is used for padding. As in the original JavaScript, the text is first escaped with JavaScript's
6+
escape() (e.g. " " becoming "%20" and "é" becoming "%E9"), and unescaped after decoding ; encoded texts made without
7+
this escaping (i.e. from the UTF-8 bytes of the text, e.g. by https://gist.github.com/tunelko/49b7e64c1688d62d0ecd)
8+
are decoded as well, except that an ASCII text holding escape sequences (e.g. "%41") is then unescaped.
9+
10+
This codec:
11+
- en/decodes strings from str to str
12+
- en/decodes strings from bytes to bytes
13+
- decodes file content to str (read)
14+
- encodes file content from str to bytes (write)
15+
16+
Reference: https://gist.github.com/tunelko/49b7e64c1688d62d0ecd
17+
"""
18+
from ._jsbase64 import js_base64
19+
from ..__common__ import add
20+
21+
22+
__examples__ = {
23+
'enc(megan35|megan-35|megan_35)': {'this is a test': 'nLX0msesRL1tOdNqicesRM=1mxb5', 'test': 'nLftn355', '': ''},
24+
'dec(megan35)': {'nLftn355': 'test', 'nLftn35': None, 'nLft@355': None},
25+
'enc-dec(megan35)': ['this is a test', 'Hello, World! 1234', '\xe9t\xe9 \u2603 \U0001f600', '100% sure', 'a'],
26+
}
27+
__guess__ = ["megan35"]
28+
29+
30+
add("megan35", *js_base64("megan35", "3GHIJKLMNOPQRSTUb=cdefghijklmnopWXYZ/12+406789VaqrstuvwxyzABCDEF5"),
31+
r"^megan[-_]?35$", printables_rate=1., expansion_factor=(1.6, .3))

0 commit comments

Comments
 (0)