Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hash Tree
Search
HORINOUCHI Masato
November 10, 2015
Technology
0
73
Hash Tree
社内LT大会 0x64物語 #02 Data Structure 資料
HORINOUCHI Masato
November 10, 2015
Tweet
Share
More Decks by HORINOUCHI Masato
See All by HORINOUCHI Masato
balenaCloud
thermes
0
66
Church Numerals
thermes
0
40
CPS & CTO
thermes
0
240
FM synthesis
thermes
0
32
A440
thermes
0
58
Inside mml2wav.rb
thermes
0
83
Scheme Interpreter in Ruby
thermes
0
68
Clock / Timer
thermes
0
150
POSIX Threads
thermes
0
53
Other Decks in Technology
See All in Technology
共有と分離 - Compose Multiplatform "本番導入" の設計指針
error96num
1
220
Kubernetes における cgroup v2 でのOut-Of-Memory 問題の解決
pfn
PRO
0
470
研究開発と製品開発、両利きのロボティクス
youtalk
1
500
バッチ処理で悩むバックエンドエンジニアに捧げるAWS Glue入門
diggymo
3
150
AWS環境のリソース調査を Claude Code で効率化 / aws investigate with cc devio2025
masahirokawahara
2
1.4k
自作JSエンジンに推しプロポーザルを実装したい!
sajikix
1
160
AI開発ツールCreateがAnythingになったよ
tendasato
0
110
未経験者・初心者に贈る!40分でわかるAndroidアプリ開発の今と大事なポイント
operando
2
160
なぜテストマネージャの視点が 必要なのか? 〜 一歩先へ進むために 〜
moritamasami
0
200
Webブラウザ向け動画配信プレイヤーの 大規模リプレイスから得た知見と学び
yud0uhu
0
220
カミナシ社の『ID管理基盤』製品内製 - その意思決定背景と2年間の進化 #AWSUnicornDay / Kaminashi ID - The Big Whys
kaminashi
3
840
大「個人開発サービス」時代に僕たちはどう生きるか
sotarok
20
9.5k
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
How STYLIGHT went responsive
nonsquared
100
5.8k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Gamification - CAS2011
davidbonilla
81
5.4k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Automating Front-end Workflow
addyosmani
1370
200k
Optimizing for Happiness
mojombo
379
70k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
A designer walks into a library…
pauljervisheath
207
24k
Transcript
Hash Tree 2015/11/10 0x64 Tales #02 Data Structure Livesense Inc.
HORINOUCHI Masato
Hash Tree ͬͯͳʹ?
֓ཁ ҉߸ཧ͓ΑͼܭࢉػՊֶʹ͓͍ͯɺϋογϡ(Hash tree, ϋο γϡπϦʔ)·ͨϚʔΫϧ(Merkle tree)ͱɺΑΓେ͖ͳσʔ λʢྫ͑ϑΝΠϧʣͷཁ݁ՌΛ֨ೲ͢ΔߏͷҰछͰ͋ ΓɺσʔλͷݕূΛߦ͏ࡍʹ༻͞ΕΔɻ — ϋογϡ
- Wikipedia
ཁ͢Δʹ… େ͖ͳσʔλΛෳσʔλϒϩοΫ ʹׂ͠ɺഁଛվ᜵ͷݕূॲཧʹ ར༻Ͱ͖Δɻ
ಈ࡞ݪཧ • ೋ • Ϧʔϑ • σʔλϒϩοΫͷϋογϡ • (෦)ϊʔυ •
ࢠϊʔυͷϋογϡΛ݁߹ͨ݁͠Ռͷϋογϡ
None
σϞ ݩσʔλੜ $ dd if=/dev/urandom of=sample bs=1M count=4 $ split
--bytes=1048576 --numeric=1 --suffix-length=1 sample L $ ls -l -rw-r--r-- 1 horinouchi horinouchi 1048576 Nov 10 18:37 L1 -rw-r--r-- 1 horinouchi horinouchi 1048576 Nov 10 18:37 L2 -rw-r--r-- 1 horinouchi horinouchi 1048576 Nov 10 18:37 L3 -rw-r--r-- 1 horinouchi horinouchi 1048576 Nov 10 18:37 L4 -rw-r--r-- 1 horinouchi horinouchi 4194304 Nov 10 18:34 sample σʔλݕূͳͲͰར༻͢ΔMerkle TreeͷϝϞ Λࢀߟʹ͠·ͨ͠ɻ
ख࡞ۀ $ openssl dgst -sha256 -binary L1 > H00 $
openssl dgst -sha256 -binary L2 > H01 $ openssl dgst -sha256 -binary L3 > H10 $ openssl dgst -sha256 -binary L4 > H11 $ cat H00 H01 | openssl dgst -sha256 -binary > H0 $ cat H10 H11 | openssl dgst -sha256 -binary > H1 $ cat H0 H1 | openssl dgst -sha256 -binary > TOP $ hexdump -C TOP
Ruby gem $ gem install treehash $ treehash sample •
Treehash • ͱ͍͑ɺ͜ͷ gem ͷதશ͘ೋͬͯͳ͍…ɻ
ZFS • Data integrity (σʔλશੑ) • σΟεΫΛॻ͖͑ͯϒϩοΫ୯ҐͰνΣοΫͰ͖Δ Αɻ • Copy-On-Write
• ϒϩοΫ୯ҐͰߋ৽ՕॴͷΈ write Ͱ͖ΔΑɻ
ଞͷ Hash Tree ͷར༻ • P2P • BitTorrent • Bitcoin
• ࢄVCS • Git
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠