CSE 115
Introduction to Computer Science I
CSE 115 Introduction to Computer Science I FINAL EXAM Tuesday, - - PowerPoint PPT Presentation
CSE 115 Introduction to Computer Science I FINAL EXAM Tuesday, December 11, 2018 7:15 PM - 10:15 PM SOUTH CAMPUS (Factor in travel time!!) CONFLICT? E-mail documentation to: alphonce@buffalo.edu Subject: CSE115 FINAL EXAM CONFLICT no
Introduction to Computer Science I
▶︎ Week overview ◀ Encryption Hashing
M: What are encryption & hashing W: encryption & hashing in practice F: cookies and authentication
Week overview ▶︎ Encryption ◀ Hashing
A has a message to send to B
A sends message to B in plaintext
Because message was sent in plaintext B can read it
Because the message was sent in plaintext anyone can read it, including unknown party C
A has a message to send to B
A encrypts the message with a secret key and sends the encrypted message to B
B cannot read the encrypted message
B decrypts the message with the (shared) secret key B can now read the message
C cannot read the message without the secret key
QUESTION: How can we distribute the shared key securely?
What if different keys were used to encrypt and decrypt?
In public key encryption each party has a public key and a private key
B sends a message to A encrypting it with A's public key A decrypts the message with their private key A's private key A's public key
A sends a message to B encrypting it with B's public key B decrypts the message with their private key B's public key B's private key
Public keys are available to anyone Private keys are known only to their owners Each Si can message R privately S0 S1 … SN R
Week overview Encryption ▶︎ Hashing ◀
We shouldn't send the password in the clear…
password password password
Ooops, anyone can see the password!
password password password
Let's encrypt the password before sending it to prevent eavesdropping.
password password password
If B stores the password, what happens if B is hacked? Passwords are revealed!
password password
A hash function is a one-way function: if cannot* be undone.
*probably
A hash function is a one-way function: if cannot be undone. "The hashing process is like a meat grinder: there is no key, everybody can operate it, but there is no way to get your cow back in full moo-ing state."
https://security.blogoverflow.com/2011/11/why-passwords-should-be-hashed/
Mincer icon made by Creaticca Creative Agency from www.flaticon.com is licensed by CC 3.0 BY
hash function
password
The password encrypted during transmission, then hashed by B. The password hash is stored, not the password.
password password
A stoled hash is less useful than a stolen password: it can't use used to directly access the account.
password password
B
Mincer icon made by Creaticca Creative Agency from www.flaticon.com is licensed by CC 3.0 BY
abc123
A
abc123
If two users have the same password, they will end up with the same hash
Adding salt (random data) to each password ensures each will hash to a different value.
B
Mincer icon made by Creaticca Creative Agency from www.flaticon.com is licensed by CC 3.0 BY
abc123
A
abc123
The password encrypted during transmission, then hashed by B. The password hash is stored together with its salt.
password password
Mincer icon made by Creaticca Creative Agency from www.flaticon.com is licensed by CC 3.0 BY
for every string: hash string + salt
C
If the hash matches your hash, that string was your password
Attacker knows your salt and hash ==
As a user: Use strong passwords! Attacker has too many strings to check
As a developer: Protect your database Attacker needs stored salt and hash to perform the attack