Obfuscated Monad Script

難読化

Monadソースコードを難読化するという記事です。
Proudly Serving My Corporate Masters: Obfuscated Monad Script

ここで紹介されているサンプル自体は確かに難読化されていますが、
難読化ソースを出力するツールは紹介されていません。
・・・というか、作者はツールではなく手で難読化スクリプトを書いたらしい。


サンプルは何をやっているかというと、
難読化された文字列「$s」を1文字ずつ読み込んで、「文字列対応表」を作成しながら文字列を複合化しています。


サンプルを実行した後、

$store.getEnumerator() | sort key

と入力すると、「文字列対応表(keyでソート)」が見えるので理解しやすいでしょう。

文字列対応表
MSH C:\> $store.getEnumerator() | sort key

Key  Value
---  -----
A    a
B    h
C    t
D    s
E    m
F    i
G    d
H    o
I    n
J    l
K    k
L    e
M    y
N    u
O    g
P    r
Q    w
R    that
S    sam-i-am
T    that sam-i-am!
U    i do not
V    like
W    do you
X    green eggs and ham
Y    them
Z    i do not like green eggs and ham
[    would you
\    like them
]    here or there
^    i would not
_    like them here or there
`    i would not like them
a    anywhere
b    i do not like them
c    would you like them
d    in a house
e    with a mouse
f    i do not like them in a house
g    i do not like them with a mouse
h    i do not like them here or there
i    i do not like them anywhere
j    i do not like them, sam-i-am