Unit 1 Basic Cryptography For Student - PPTX 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Bitcoin

Blockchain
Technology
Unit 1: Basic Cryptography
Fri, Sep 17

By #satochit

“Finding a Signal in the Noise”


Unit 1: Basic Cryptography
● Public key private key

● Hashing function

● Digital signature

● Address

● Wallet
Hash Function
● กระบวนการทําให data มีขนาดเล็กลง -> data fingerprint
● เปน one way function (รู hash value ไมสามารถยอนหา original message ได
● มีคุณสมบัติ deterministic (given input always same hash value)

X 🡪 H(X) = Hash Value

Application of Hash in Bitcoin

● Bitcoin Address
● Transaction, Block
● Chaining Block into Blockchain
● Mining the Block
https://xorbin.com/tools/sha256-hash-calculator

SHA-256 Hash Calculator


Beer list (500ml Can) Beer list (500ml Can)
รายการเบียรสดบรรจุกระปอง รายการเบียรสดบรรจุกระปอง
1.Porn’s milk stout 6.0% 1.Porn’s milk stout 6.0%
2. Whale Pale Ale 5.2% 2. Whale Pale Ale 5.2%
3.Deschutes Neon day dream hazy ale 4.8% 3.Deschutes Neon day dream hazy ale 4.8%
Text Input 4.Good chit Pilsner 5.2% 4.Good chit Pilsner 5.2%
5.Chitbeer Nevada pale ale 5.6% 5.Chitbeer Nevada pale ale 5.6%
7.Drink dank Gan IPA 6.5% 7.Drink dank Gan IPA 6.5%
8. Chitbeer Talom pale ale 5.9% 8. Chitbeer Talom pale ale 5.9%
9.Chitbeer Raspberry Stout 7.2% 9.Chitbeer Raspberry Stout 7.2%
10.Rouge Batsquatch hazy IPA 6.7% 10.Rouge Batsquatch hazy IPA 6.7%
11.Chitbeer hardcore DIPA 7.5% 11.Chitbeer hardcore DIPA 7.5%
H(X)
12.Deschutes Chainbreaker White IPA 5.6% 12.Deschutes Chainbreaker White IPA 5.6%
13 Sour Black berry milk shake 8.4% 13 Sour Black berry milk shake 8.4%
14.Spacecraft discovery wheat 5.2% 14.Spacecraft discovery wheat 5.4%

Hash Value 256 bits or 32 bytes 256 bits or 32 bytes

05cec7dc7d7ecbd024db81ca28c984dd7 3837607ff0f050a0aeb32430d9e522ffe
e260117b85e1056703d876c5c97f356 d46594783bd673d2a22be81a8271239
Public-key Cryptography
● Private key = secret key
● Public key = sharable key
● Lock = encrypt
● Unlock = decrypt

Alice Bob

If Alice want to lock a message for Bob, After Bob receive the message, which key
which key to use? to use to unlock the message?
Quiz
“Bob want to send the secret message to Alice” Please fill in the blank

“Bomb time
Bob
is 21.00 Fri,
Sep 17”

Choices
A. Encrypt
B. Decrypt 21b9789496580c1546675ed11dacbe526
C. Hash 996fb5796c6c068e55522185f778b3e
D. Alice’s Public Key
E. Alice Private Key
F. Bob Public Key
G. Bob Private Key
“Bomb time
Alice is 21.00 Fri,
Sep 17”
How public-key cryptography works in Bitcoin
1. You send me a copy of your public key

2. I put bitcoin inMe


the box and lock it using your public
You key, then send the box back to you

3. When you getMe


the box, you open it with your private
You key and claim the bitcoin I sent to you

Me You
Digital Signature (1/2)
● To sign or certify the message เซ็นตรับรอง
ขอความ เอกสารขอตกลง หรือ sign
transaction

“I, Alice agree to 7ba40fa085977af531dff8467ed11848b


pay Bob $20” HASH 05e5f5447f2f1c116e9ede00a40703b

Alice

ENCRYPT
Alice’s Private Key

เรียกขอมูลชุดนี้ d73jY9M8/LyQPCjejEkiNaT+PUl9spI+v7kMn3TyGtlY
zbKio7JGmCSjicbON1hcV/uLQWgQUMprnFRJ/yKppVSo
วา
DIGITAL SIGNATURE sq1vC25P9Xe6P5VbnA+wWTuyvyMuG1KiOFw+rIGcKXjs
7QlhTIil+2jxpip2R+0GM2DZvbrHqFkzpMITn04
Digital Signature (2/2)
● To verify if it’s true that Alice sign the
message ใครๆสามารถตรวจสอบไดวา Alice
เปนคนเซ็นตรับรองขอความนี้

“I, Alice agree to 7ba40fa085977af531dff8467ed11848b


pay Bob $20” HASH 05e5f5447f2f1c116e9ede00a40703b

If equal “YES”
1 If not equal
- Message change
-OR-
Bob
2 - Alice not sign
d73jY9M8/LyQPCjejEkiNaT+PUl9sp
I+v7kMn3TyGtlYzbKio7JGmCSjicbO 7ba40fa085977af531dff8467ed11848b
N1hcV/uLQWgQUMprnFRJ/yKppVSosq DECRYPT 05e5f5447f2f1c116e9ede00a40703b
1vC25P9Xe6P5VbnA+wWTuyvyMuG1Ki
OFw+rIGcKXjs7QlhTIil+2jxpip2R+
0GM2DZvbrHqFkzpMITn04
Alice’s Public Key
DIGITAL SIGNATURE
QUIZ
● 3 things needed to verify Alice’s DIGITAL SIGNAURE

1. ______________________________________________

2. ______________________________________________

3. ______________________________________________
Address
● Public and private keys are generally used for locking and unlocking messages
● The two keys are mathematically related
● The public key is made from the private key
● The private key can’t be regenerated from the public key
● In Bitcoin, keys are used for locking and unlocking bitcoin on the blockchain
● Address are related to public key, the bitcoin address is generated from its public key
Private Key Hexadecimal Format (64 characters [0-9A-F]):
446A6887326ED5C9F3A428BE9972FB6F7CA3A27FFDF14D1FD1A21107A982FFDA

Private Key WIF Compressed


KyWhfiEE98iUgpzDeJdvHW6kzUm55KjEupBmVx1ppRWECockZ8YA

Public Key (compressed, 66 characters [0-9A-F]):


03DA0D6013F11162526519B1EDC1A81F8C0AEEB1FEB0BF0BB97B33CB6924F03377

Bitcoin Address
13wbbTtHzJASxo2YEahdqzdyJEK7twRV6d
Wallet
● To store and spend money
● Not hold the value directly but hold access to it on the blockchain
● The private key stored in your bitcoin wallet 🡪 ability to move funds
● If you lose keys, you lose access to your funds
● We can store our private keys in different ways

“Think of Wallet as a Keychain”


QUIZ
Private key is a very larger number. Please convert Private Key to Decimal Number

Private Key Hexadecimal Format (64 characters [0-9A-F]):


446A6887326ED5C9F3A428BE9972FB6F7CA3A27FFDF14D1FD1A21107A982FFDA

Hint: https://www.rapidtables.com/convert/number/hex-to-decimal.html
Q&A

You might also like