ArcBlock's Technical Learning Series presents: Cryptography for everyone.
Cryptography is a foundational piece in BlockChain technology. The reason BlockChain is secured is based on the promise of the underlying cryptographic primitives. In this talk, we will give an introduction to cryptography, from symmetric encryption to public key encryption. We will see how it makes blockchain technology possible. Also, we will talk about the crypto primitives behind cryptocurrency wallet. So you will know how important is your private key.
区块链是集多种高大上技术为大成的应用,密码学占其中最重要的一环。事实上,平日我们在互联网上做的任何事情都有密码学的身影在里面。区块链所用到的的sha256, secp256k1, ed25519都是些什么鬼?本次讲座将从一个最简单的问题开始——如何隐藏不能说的秘密——一直讲到现代密码学在区块链以及钱包中的应用,为您揭开密码学娇羞的面纱。 听完您会明白,为什么我不该在云上备份钱包里的私钥。
https://www.arcblock.io
6. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 6/39
ASCII
------------US-ASCII-------------
0 1 2 3 4 5 6 7 8 9 a b c d e f
2 ! " # $ % & ' ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ ] ^ _
6 ` a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ~
---------------------------------
A 41 0100 0001
T 54 0101 0100
T 54 0101 0100
A 41 0100 0001
C 43 0100 0011
K 4b 0100 1011
20 0010 0000
A 41 0100 0001
T 54 0101 0100
20 0010 0000
D 44 0100 0100
A 41 0100 0001
W 57 0101 0111
N 4e 0100 1110
6
7. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 7/39
Coin toss
- head 0
- tail 1
0101
0011
1110
0100000101010100010101000100000101000011010010110010000001000001010101000010000001000100010000010101011101001110 ATTACK AT DAWN
0001000001001011001001111100001001011110001010110101011000010000010111110000010011110100011100101011010000110100 random coin toss
0101000100011111011100111000001100011101011000000111011001010001000010110010010010110000001100111110001101111010 ciphertext
7
8. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 8/39
One-time Pad
• perfect secrecy
• as long as the plaintext
• not practical in real life
• can we do better?
8
10. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 10/39
DES
• Data Encryption Standard
• 1970s
• IBM
• block size: 8 bytes
• key size: 8 bytes
10
11. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 11/39
3DES
• 1998
• DES -> DES -> DES
• key size: 8 * 3 = 24 bytes
• also 3 times slower than DES
11
12. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 12/39
AES
• Advanced Encryption Standard
• 1997 - 2000
• NIST
• Finalists
• Rijndael/Serpent/Twofish/RC6/MARS
• Rijndael become AES
12
22. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 22/39
How to securely send my message to others?
22
23. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 23/39
Alice, Bob & Eve
.
secret
Alice ----------------------------------> Bob
key key
secret secret'
Alice ------------ Eve -------------> Bob
key key
23
24. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 24/39
Cryptographic Hash Functions
• data integrity
.
secret
digest
Alice ----------------------------------> Bob
key key
24
25. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 25/39
Ideal Hash Function
• deterministic, same input always generate same output
• quick to compute for any input
• one-way function
• avalanche effect, samell change in input cause huge change in output
• collision resistance, infeasible to find two different inputs generate same output
25
27. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 27/39
SHA3
• NIST, 2007
• Finalists, 2012
• BLAKE
• Grøstl
• JH
• Keccak <- this guy wins
• Skein
• SHA-3, 2015
• Ethereum uses original 2012 keccak256
27
28. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 28/39
Is data integrity enough?
.
secret
digest
Alice ----------------------------------> Bob
key key
secret secret'
digest digest'
Alice ------------ Eve -------------> Bob
key key
28
30. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 30/39
MAC
.
secret
digest
Alice ----------------------------------> Bob
key key
secret
tag
Alice ----------------------------------> Bob
{k1,k2} {k1,k2}
secret secret'
tag ??????
Alice ------------ Eve -------------> Bob
{k1,k2} {k1,k2}
30
31. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 31/39
How do Alice and Bob swap keys at the rst place?
31
32. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 32/39
Is key exchange possible?
.
secret secret'
tag ??????
Alice ------------ Eve -------------> Bob
{k1,k2} {k1,k2}
{k1,k2}
Alice ------------ Eve -------------> Bob
???
32
33. 1/15/2019 Cryptography for Everyone
http://10.0.1.12:8888/bbl/bbl23-crypto.html 33/39
Di e-Hellman-Merkle key exchange
• 1976
33