VIFF(Virtual Ideal Functionality Framework)を動かす
マルチパーティ計算(MPC, Multi-Party Computation)の論文で VIFF(Virtual Ideal Functionality Framework)が使用されていることがあります。(Secure Multiparty AES (full paper))
- VIFF is a framework which allows you to specify secure multi-party computations.
- VIFF is Free Software, licensed under the GNU LGPL.
アーカイブ(後述) より
サイト消滅
http://viff.dk/が VIFF の公式サイトとして紹介されることが多いですが(https://github.com/rdragos/awesome-mpc#retired-software)、現在アクセスしても、よくわからないサイトが出現します。
Wayback Machine
Wayback Machine(https://web.archive.org)を使用してサイトのアーカイブを探しました。
以下がおそらく最新のアーカイブです。
https://web.archive.org/web/20220531200136/http://viff.dk/
実行
VIFF のコードでは Python2 を使用していますが、(個人的に)メインの環境に Python2 をインストールしたくないので、ここでは Docker を使用します。
docker run --rm -it python:2 bash
ソースコードを取得、解凍
https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.zip
# apt update && apt install curl unzipcurl -OL https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.zipunzip tip.zip
https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.tar.gz
# apt update && apt install curl gzipcurl -OL https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.tar.gztar -xzvf tip.tar.gz
https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.tar.bz2
# apt update && apt install curl bzip2curl -OL https://web.archive.org/web/20220120210407/http://hg.viff.dk/viff/archive/tip.tar.bz2tar -xjvf tip.tar.bz2
ツリー構造
tree -a viff-f1d477e94d0b/
ディレクトリviff-f1d477e94d0b/
- .hg_archival.txt
- .hgignore
- .hgsigs
- .hgtags
- COPYING
- COPYING.LIB
- MANIFEST.in
- NEWS
- README
ディレクトリapps
- aes.py
- aes_inversion.py
- beginner.py
- benchmark.py
- benchutil.py
- compare.py
- divide.py
ディレクトリdouble-auction
- auction-client.glade
- auction-client.gladep
- client.py
- double-auction.py
- server.py
- equality.py
- eval-poly.py
- gc-test.py
- generate-certificates.py
- generate-config-files.py
- int-bit-conversion.py
- millionaires.py
- multiply.py
- online-comparison-benchmark.py
- paillier.py
- prss-and-open.py
- recombine.py
- seq-mul.py
- shamir-share-open.py
- share-open.py
- sort.py
- sum.py
- two-fields.py
- xor-all.py
ディレクトリdoc
- active.txt
- aes.txt
- applications.txt
- authors.txt
- background.txt
- bibliography.txt
- coding-style.txt
- comparison.txt
- conf.py
- config.txt
- constants.txt
- contact.txt
- development.txt
- field.txt
- glossary.txt
- hashbroadcast.txt
- history.txt
- implementation.txt
- index.txt
- install.txt
- matrix.txt
- orlandi.txt
- overview.txt
- paillier.txt
- passive.txt
- preprocessing.txt
- presentations.txt
- program-counters.txt
- prss.txt
- runtime.txt
- shamir.txt
- todo.txt
- unit-testing.txt
- util.txt
- run.py
- setup.py
ディレクトリtwisted
ディレクトリplugins
- viff_reactor.py
ディレクトリviff
- __init__.py
- active.py
- aes.py
ディレクトリbedoza
- __init__.py
- add_macs.py
- bedoza.py
- bedoza_triple.py
- keylist.py
- maclist.py
- modified_paillier.py
- share.py
- share_generators.py
- shares.py
- util.py
- zero_knowledge.py
- comparison.py
- config.py
- constants.py
- equality.py
- field.py
- hash_broadcast.py
ディレクトリlibs
- __init__.py
- configobj.py
- matrix.py
- montgomery_exponentiation.py
- orlandi.py
- paillier.py
- paillierutil.py
- passive.py
- prss.py
- reactor.py
- runtime.py
- shamir.py
- simplearithmetic.py
ディレクトリtest
- __init__.py
ディレクトリbedoza
- __init__.py
- test_bedoza_runtime.py
- test_bedoza_triple.py
- test_test_setup.py
- test_zero_knowledge.py
- util.py
- loopback.py
- rijndael.py
- test_active_runtime.py
- test_aes.py
- test_apps.py
- test_async.py
- test_basic_runtime.py
- test_field.py
- test_hash_broadcast.py
- test_matrix.py
- test_memory.py
- test_orlandi_runtime.py
- test_prss.py
- test_runtime.py
- test_runtime_comp.py
- test_runtime_equal.py
- test_runtime_open.py
- test_runtime_prss.py
- test_shamir.py
- test_signed_field.py
- test_thresholds.py
- test_util.py
- util.py
- triple.py
- util.py
セットアップ
cd viff-f1d477e94d0b/
pip install gmpy twistedpython setup.py install
プレイヤーの設定ファイル生成
python apps/generate-config-files.py localhost:10044 localhost:10045 localhost:10046
AES 暗号化を実行
python apps/aes.py --keylength 256 --exponentiation 2 player-3.ini &>result-3.log &python apps/aes.py --keylength 256 --exponentiation 2 player-2.ini &>result-2.log &python apps/aes.py --keylength 256 --exponentiation 2 player-1.ini &>result-1.log &
Seeding random generator with random seed 7277Not using SSLListening on port 10044Will connect to <Player 2: localhost:10045>Will connect to <Player 3: localhost:10046>Started at 1730142229.899632.Use shortest_chain_with_least_rounds for inversion by exponentiation.Round 0 preparation: 0.000577, 0.000578Round 1 preparation: 0.011843, 0.012446Round 1: 0.062731, 0.075170Round 2 preparation: 0.037283, 0.112481Round 2: 0.005591, 0.118064Round 3 preparation: 0.039368, 0.157465Round 3: 0.004896, 0.162352Round 4 preparation: 0.038485, 0.200861Round 4: 0.004810, 0.205664Round 5 preparation: 0.037220, 0.242917Round 5: 0.005976, 0.248885Round 6 preparation: 0.037890, 0.286799Round 6: 0.004862, 0.291650Round 7 preparation: 0.038013, 0.329697Round 7: 0.004782, 0.334472Round 8 preparation: 0.038121, 0.372626Round 8: 0.047589, 0.420207Round 9 preparation: 0.037544, 0.457786Round 9: 0.005132, 0.462856Round 10 preparation: 0.038838, 0.501718Round 10: 0.004578, 0.506287Round 11 preparation: 0.037208, 0.543521Round 11: 0.006219, 0.549731Round 12 preparation: 0.038126, 0.587883Round 12: 0.004849, 0.592449Round 13 preparation: 0.036589, 0.629070Round 13: 0.008404, 0.637264Round 14 preparation: 0.050072, 0.687371Round 14: 0.006582, 0.693165Total preparation time: 0.517176Total communication time: 0.177001Finished after 0.693403 sec.Ciphertext: ['0x19', '0xcc', '0x96', '0xe0', '0xe9', '0xb5', '0x82', '0x24', '0xc7', '0x85', '0x6c', '0x37', '0x7a', '0x7e', '0x15', '0xc6']Synchronizing shutdown... done.Closing connections... done.Stopping reactor... done.