Sim's blog

電子工作はじめてみました

ICFP2007 (15) Fuun Security Features

2007-08-30 23:43:13 | ICFPプログラミングコンテスト
ICFP2007 (14)の続きです。

以前も貼りましたがカタログのpage 4405829です。



help-fuun-securityという関数で表示されています。中身を見てみると何のひねりもなく暗号化された文字列を表示しているだけでした。コードから文字列を抽出しました。
Shhaf pbagnva n terng qrny bs cebcevrgnel grpuabybtl. Gb cebgrpg gur Vagryyrpghny Cebcregl 
evtugf bs ShhaGrpu naq vgf fgbpxubyqref, pregnva cnegf bs n Shha'f QAN ner rapelcgrq hfvat 
bar bs gjb pelcgbtencuvp grpuabybtvrf. Guvf ranoyrf fhpu cnegf gb or npprffrq bayl ol gubfr 
phfgbzref jub unir bognvarq gur arprffnel npprff pbqrf.

Zrgubq N jnf hfrq va gur cnfg, ohg vg unf erpragyl orra oebxra. Vaqrrq, gur rapelcgvba fpurzr 
jnf erirnyrq gb or fb synjrq gung vg pna or oebxra znahnyyl. Vg vf fgvyy va hfr sbe fbzr cnegf bs 
gur flfgrz, ohg ShhaGrpu vf zvtengvat njnl sebz vg. Jr jvyy abg qvfphff vg shegure.

Zrgubq O, n ShhaGrpu genqr frperg, vf fvtavsvpnagyl zber cbjreshy. Vg erdhverf gur phfgbzre 
gb rapbqr n fcrpvny frdhrapr bs punenpgref, pnyyrq n "xrl", vagb uvf Shha'f QAN ng n fcrpvsvp 
ybpngvba. Vs gur xrl vf cerfrag, gur pbeerfcbaqvat shapgvbanyvgl orpbzrf ninvynoyr. Bgurejvfr, 
Shha orunivbhe znl enatr sebz na reebe zrffntr gb ivbyrag qrngu.

Vs lbh unir ybfg n xrl, erpbirel bs gur xrl vf abg trarenyyl cbffvoyr qhr gb gur pbzcyrkvgl bs gur 
pelcgbtencuvp grpuabybtl. (Vg vf n tbbq vqrn gb jevgr qbja xrlf fbzrjurer, znlor rira ba n lryybj 
cvrpr bs cncre nggnpurq gb lbhe pbzchgvat qrivpr.) Ubjrire, vs lbhe xrl vf fhssvpvragyl fubeg, lbh 
znl or noyr gb erpbire vg hfvat gur Shha'f xrl penpxre. Gb or noyr gb hfr gur penpxre, lbh zhfg 
fgvyy unir lbhe chepunfr pbqr (n 24-npvq frdhrapr). Cyrnfr npgvingr gur penpxre trar, cnffvat vg 
gur chepunfr pbqr, naq nsgre fbzr crevbq bs gvzr vg znl cevag bhg lbhe xrl. Or cercnerq gb jnvg n 
ybat gvzr. Va gur Fybj Mbar, penpxvat n 2-punenpgre xrl znl gnxr zvahgrf, juvyr n 3-punenpgre 
xrl znl gnxr ubhef.

*** Qrgnvyrq qrfpevcgvba bs Zrgubq O (fhowrpg gb AQN) ***

1. Znxr n yvfg bs ahzoref, 0 gb 255.

2. Frg gur pbhagre sbb gb mreb.

3. Yrg one pbhag sebz 0 gb 255 naq rnpu gvzr, nqq gur one'gu ryrzrag bs gur yvfg naq gur one
'gu punenpgre bs gur xrl (jenccvat nebhaq gb gur fgneg bs gur xrl vs arprffnel) gb sbb, naq fjnc 
gur sbb'gu naq one'gu ryrzragf bs gur yvfg.

4. Erfrg sbb naq one gb mreb.

5. Sbe nyy gur qngn lbh jnag gb rapelcg be qrpelcg:

     N. Vapernfr sbb, nqq gb one gur sbb'gu ryrzrag bs gur yvfg, gura fjnc gur sbb'gu naq one'gu 
ryrzragf.

     O. Nqq gubfr gjb ryrzragf, fcyvg gur erfhyg vagb sbhe tebhcf, naq KBE gurz jvgu gur npvqf 
(V = 0, P = 1, S = 2, C = 3).

Nyy nevguzrgvp fubhyq or qbar jvgu 8 fvtavsvpnag npvqf.

暗号化はA→N、B→O・・・のように文字を置き換えているだけです。復号結果です。
Fuuns contain a great deal of proprietary technology. To protect the Intellectual Property 
rights of FuunTech and its stockholders, certain parts of a Fuun's DNA are encrypted using 
one of two cryptographic technologies. This enables such parts to be accessed only by those 
customers who have obtained the necessary access codes.

Method A was used in the past, but it has recently been broken. Indeed, the encryption scheme 
was revealed to be so flawed that it can be broken manually. It is still in use for some parts of 
the system, but FuunTech is migrating away from it. We will not discuss it further.

Method B, a FuunTech trade secret, is significantly more powerful. It requires the customer 
to encode a special sequence of characters, called a "key", into his Fuun's DNA at a specific 
location. If the key is present, the corresponding functionality becomes available. Otherwise, 
Fuun behaviour may range from an error message to violent death.

If you have lost a key, recovery of the key is not generally possible due to the complexity of the 
cryptographic technology. (It is a good idea to write down keys somewhere, maybe even on a yellow 
piece of paper attached to your computing device.) However, if your key is sufficiently short, you 
may be able to recover it using the Fuun's key cracker. To be able to use the cracker, you must 
still have your purchase code (a 24-acid sequence). Please activate the cracker gene, passing it 
the purchase code, and after some period of time it may print out your key. Be prepared to wait a 
long time. In the Slow Zone, cracking a 2-character key may take minutes, while a 3-character 
key may take hours.

*** Detailed description of Method B (subject to NDA) ***

1. Make a list of numbers, 0 to 255.

2. Set the counter foo to zero.

3. Let bar count from 0 to 255 and each time, add the bar'th element of the list and the bar
'th character of the key (wrapping around to the start of the key if necessary) to foo, and swap 
the foo'th and bar'th elements of the list.

4. Reset foo and bar to zero.

5. For all the data you want to encrypt or decrypt:

     A. Increase foo, add to bar the foo'th element of the list, then swap the foo'th and bar'th 
elements.

     B. Add those two elements, split the result into four groups, and XOR them with the acids 
(I = 0, C = 1, F = 2, P = 3).

All arithmetic should be done with 8 significant acids.

purchase codeをcrackerに渡すと鍵を表示してくれると書いてあります。impdoc2に載っているcrackKeyのことです。purchase codeは3つ分かっています(8/24)。
- int24 help-beautiful-numbers_purchase_code
- int24 help-error-correcting-codes_purchase_code
- int24 vmu-code_purchase_code

このドキュメントに載っている暗号アルゴリズムはRC4そのものです。SSLやWEPなんかで使われています(もしかすると過去形?)。

コンピュータの横に張っておくなんてことも書いてあります。stickyの画像のことなんでしょうね。