Grokking Algorithms



Yüklə 348,95 Kb.
Pdf görüntüsü
səhifə107/122
tarix05.12.2023
ölçüsü348,95 Kb.
#173611
1   ...   103   104   105   106   107   108   109   110   ...   122
grokking-algorithms-illustrated-programmers-curious

Chapter 11
 
 
I
 
 
Where to go next
But you can’t get the original string from the hash.
That means if an attacker gets the SHA hashes from Gmail, they can’t 
convert those hashes back to the original passwords! You can convert a 
password to a hash, but not vice versa. 
SHA is actually a family of algorithms: SHA-0, SHA-1, SHA-2, and 
SHA-3. As of this writing, SHA-0 and SHA-1 have some weaknesses.
If you’re using an SHA algorithm for password hashing, use SHA-2 or 
SHA-3. The gold standard for password-hashing functions is currently 
bcrypt (though nothing is foolproof). 
Locality-sensitive hashing
SHA has another important feature: it’s locality insensitive. Suppose you 
have a string, and you generate a hash for it.
If you change just one character of the string and regenerate the hash, 
it’s totally different!
This is good because an attacker can’t compare hashes to see whether 
they’re close to cracking a password. 
Sometimes, you want the opposite: you want a locality-sensitive hash 
function. That’s where 
Simhash
comes in. If you make a small change 
to a string, Simhash generates a hash that’s only a little different. This 
allows you to compare hashes and see how similar two strings are, 
which is pretty useful! 
• Google uses Simhash to detect duplicates while crawling the web. 
• A teacher could use Simhash to see whether a student was copying an 
essay from the web.


217
Diffie-Hellman key exchange
• Scribd allows users to upload documents or books to share with 
others. But Scribd doesn’t want users uploading copyrighted content! 
The site could use Simhash to check whether an upload is similar to a 
Harry Potter book and, if so, reject it automatically. 
Simhash is useful when you want to check for similar items.

Yüklə 348,95 Kb.

Dostları ilə paylaş:
1   ...   103   104   105   106   107   108   109   110   ...   122




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin