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
77
0
Share
Hash Tree
社内LT大会 0x64物語 #02 Data Structure 資料
HORINOUCHI Masato
November 10, 2015
More Decks by HORINOUCHI Masato
See All by HORINOUCHI Masato
balenaCloud
thermes
0
77
Church Numerals
thermes
0
50
CPS & CTO
thermes
0
250
FM synthesis
thermes
0
37
A440
thermes
0
63
Inside mml2wav.rb
thermes
0
86
Scheme Interpreter in Ruby
thermes
0
70
Clock / Timer
thermes
0
160
POSIX Threads
thermes
0
56
Other Decks in Technology
See All in Technology
昔話で振り返るAWSの歩み ~S3誕生から20年、クラウドはどう進化したのか~
nrinetcom
PRO
0
130
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
170
FlutterでPiP再生を実装した話
s9a17
0
240
Embeddings : Symfony AI en pratique
lyrixx
0
440
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
650
Tour of Agent Protocols: MCP, A2A, AG-UI, A2UI with ADK
meteatamel
0
190
Databricks Lakehouse Federationで 運用負荷ゼロのデータ連携
nek0128
0
100
Data Enabling Team立ち上げました
sansantech
PRO
0
170
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
320
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
160
「できない」のアウトプット 同人誌『精神を壊してからの』シリーズ出版を 通して得られたこと
comi190327
3
520
遊びで始めたNew Relic MCP、気づいたらChatOpsなオブザーバビリティボットができてました/From New Relic MCP to a ChatOps Observability Bot
aeonpeople
1
150
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Abbi's Birthday
coloredviolet
2
6.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
Speed Design
sergeychernyshev
33
1.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The browser strikes back
jonoalderson
0
870
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠