Please enable JavaScript.
Coggle requires JavaScript to display documents.
Crypto Crash course (Hashes (functions (MD5, SHA1, SHA2), take in…
Crypto Crash course
Hashes
take in arbitrary data blob
geenrate fixed-size output
128-512 bits
functions
MD5
SHA1
SHA2
all prod collisions
multiple inputs
prod same output
strength
how hard to find such collisions
MACs
Message authentication codes
based on hashes
data not tampered with
validating MAC itself
not manipulated
shared key
used for construction
validation of MAC
w/0 can't create MAC
examples
HMAC
(key, message) = hash (key+hash(key+message))
keys are padded separately
each run
minor simplification
One-Time Pad
Use a given key only once
Don't want to give out massive pre-generated keys
Don't use OTP for day-to-day
XOR
bitwise operator
property
ability to reverse itself
D=A ^ B
A==D ^ B
B==D ^ A
perfect cryptio scheme
generate key of N bits
true random data
XOR each bits of key
N bits of plaintext
perfectly encrypted ciphertext blob of N bits
Decryption
XORing against same keystream
given 2 bits(denoted A and B)
Either A or B 1, output =1
0^0 ==0
1^1 ==0
Ciphers types
Symmetric
stream
both sides share same key
random numb generator
seeded with key
generates bytes
XORed with each byte of plaintext
for encryption
decryption is XORing ciphertext
both operations are identical
encrypts data byte-by-byte
common
RC4
used in SSL
simpler
stream cipher
given PRNG
seeding keys
both sides
strength
quality of randomness
block
Encrypts data block-by-block
Examples
AES (Rijndael)
DES
3DES
Twofish
how it works?
split data into N-byte block
encrypt those separately
can't assume data multiple of n-bytes long
pad data
introducing complexity
encryption and decryption
!= same
ECB Mode
Electronic CodeBook
each plaintext
encrpted independently
prod ciphertext block
2 blocks with same ciphertext
same plaintext
CBC Mode
each plaintext block
XORED
ciphertext previous
block before encryption
first block
Initialization vector
chained
flipping one bit of ciphertext
in block 0
flip same bit position
plaintext in block 1
Asymmetric
each side has own private key
exchange public keys
examples
RSA
Alice send to Bob
encrypt
message with symmetric key
key with bob public key
send ciphertext and
encrypted key to bob
decrypt key with private key
decrypt message
used
encryption
signing
process
allow one party to validate source
of message
securely
transmit symmetric key