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
67
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
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
110
ChatGPTとPlantUML/Mermaidによるソフトウェア設計
gowhich501
1
130
サラリーマンの小遣いで作るtoCサービス - Cloudflare Workersでスケールする開発戦略
shinaps
2
440
「Linux」という言葉が指すもの
sat
PRO
4
130
allow_retry と Arel.sql / allow_retry and Arel.sql
euglena1215
1
170
20250913_JAWS_sysad_kobe
takuyay0ne
2
200
開発者を支える Internal Developer Portal のイマとコレカラ / To-day and To-morrow of Internal Developer Portals: Supporting Developers
aoto
PRO
1
460
2025年夏 コーディングエージェントを統べる者
nwiizo
0
160
TS-S205_昨年対比2倍以上の機能追加を実現するデータ基盤プロジェクトでのAI活用について
kaz3284
1
120
Webブラウザ向け動画配信プレイヤーの 大規模リプレイスから得た知見と学び
yud0uhu
0
230
「何となくテストする」を卒業するためにプロダクトが動く仕組みを理解しよう
kawabeaver
0
410
ガチな登山用デバイスからこんにちは
halka
1
240
Featured
See All Featured
Faster Mobile Websites
deanohume
309
31k
RailsConf 2023
tenderlove
30
1.2k
BBQ
matthewcrist
89
9.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
A designer walks into a library…
pauljervisheath
207
24k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Language of Interfaces
destraynor
161
25k
How GitHub (no longer) Works
holman
315
140k
Thoughts on Productivity
jonyablonski
70
4.8k
Docker and Python
trallard
45
3.6k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
YesSQL, Process and Tooling at Scale
rocio
173
14k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠