how does decryption differ from reversing a hash algorithm?

186 views

I am struggling to understand how one is fast enough to underly the entire internet and how the other is so slow as to be functionally impossible.

As an expansion, since the public key is known, how then is the encrypted message irreversible?

In: 4

8 Answers

Anonymous 0 Comments

I’m still learning this, but just because something is encrypted, it doesn’t mean that it’s hashed. Encryption is for the confidentiality of the file, where hashing is for the integrity. With encryption, if you have a decryption key, you can reverse it. Hashing isn’t reversible. With encryption, you can use that decryption key to return a file to plaintext. You can’t do that with a hash.

Basically, you encrypt the file to make sure only people who can decrypt it can access it. You hash the file to make sure it doesn’t get altered without your permission. You can check the file against your hashed version of it. If they match, then the data wasn’t altered. If they don’t, then you know someone changed it in some way.

With the public/private key pairs, you need to have both in order to decrypt the message. Using a key pair is Asymmetric encryption. You encrypt with one and decrypt with the other. If it were a symmetric encryption, then there’s only one key, and if that’s compromised, then so is the security of whatever’s encrypted.

Anonymous 0 Comments

Encryption and decryption are information preserving operations.

Hash functions are not. If you hash a number into 64 bins, there are only 64 possible answers even through there are zillions of possible inputs. Clearly, this is not reversible.

The whole point of the hash is to be much smaller than the number of bits needed to store a copy of the information, while providing some evidence of tampering.

Anonymous 0 Comments

Hashing isn’t encryption. Hashing is simply a method of converting any message of an arbitrary size to a fixed-length, deterministic outcome. Necessarily, hashing destroys information, meaning that any given hash actually represents and infinite number of possible inputs. So it is impossible to “reverse” a hash because you have no way of knowing whatever you get was the correct original image.

For your second question, public keys are used in a form of encryption known as asymmetric encryption. They rely on mathematical functions that are easy to perform one way, but not in reverse. The most common example is multiplication and factorization. Computers can easily multiply two numbers together, but if you give it a number and ask it to factorize it, there are currently no efficient algorithms to do it. Given our current understanding of math and available computing power, and the sizes of the numbers in question, you are better off just making random guesses.

Anonymous 0 Comments

Because cryptographic hash function uses a mathematical function that is a one-way function. That is easy in one direction but hard in the other. Easy mean fast for a computer to calculate, hard means it is slow for a computer to calculate.

Encryption does not include functions like that or more exactly it does not include them without you knowing part of the input that makes it simple to do. That information is derived from the encryption key. _

One example of that is multiplication and factoring. Taking two prime numbers the multiplying them is very easy to do. But finding what is the two prime factors of a number is not easy to do. You have to remember for things like public-key encryption were talking about products that can be 2048 bits that is 616 decimal digits.

The best way we know to find the factors is to test with all possible prime factors and see if it works out. This is an enormous number of possible prime numbers to test.

But if you have one of the prime numbers calculating the other with division is not hard at all. This is not exactly how the calculation is done in public-key encryption like RSA but it all boils down to finding prime factors of large numbers is hard,

https://en.wikipedia.org/wiki/RSA_(cryptosystem)

In a way, you can think of a hash function and the message is use to generate the encryption key, the message is then encrypted with that key and the key is forgotten. This is not how it is done but give some idea of the diffrence.

A hash function often includes the parts where multiple input can result in the same input.

Let’s say that we hash four-digit numbers by splitting them apart into two numbers and adding and using the two last digits. 5569 become 55+69= 124 =24. If you have 24 how do you go back to 5569? There are lots of other numbers that give 24 as the result 0024, 0123, 1014, 5668 etc So going backward results in multiple possible inputs.

The result is that the practical way to find the input that results in a specific hash value is to just test multiple inputs and find a message that results in that hash.

Anonymous 0 Comments

Encryption is fast enough for all of HTTPS to use because the people involved have the correct keys to unlock the encryption. Without the keys encryption would also be age of the universe slow as you try to brute force. Brute forcing hashes is actually way faster than brute forcing encryption, it’s jsut no one brute forces encryption.

Anonymous 0 Comments

This is how I explain hashing in a very simple way.
Your date of birth is 7-7-2000.. so I use algorithm, adding all numbers.. 7+7+2=16 , 1+6= 7.. so hash of your DOB is 7.
Now if u want to test whether ur gf knows your DOB or not, in presence of other friends.
She should confirm loudly but without letting others to know it.
You- tell me hash if you know my DOB
She- 7
You – yeah u know it.

But by her answer.. noone can guess your DOB
So hashing is an algorithm, which destroys whole info.. but keeps one special number.

My hashing is simple.. but original algorithm does a lot of calculation to produce a fixed number.
Encryption is doing code.. suppose your secret key is 11111112 then 07072000 is.. 07072000 + 11111112=18183112 (coded).
So now u know the secret key..
Now in front of others I can tell u my DOB is 15163022 , you can subtract the key and u will know the answer.

In short
Hash is just confirmation. You can’t get original specific DOB by a number 8
But encrypted 12123012 can give you specific DOB after decryption.

Anonymous 0 Comments

A hash is a one way operation. Information is lost when you hash data. Even if you hashed a 256 bit number into a 256 bit hash, it is still a one way function. The sha256 hash algorithm is irreversible. It’s a trap door function.

In simple terms encryption is asymmetrical which means the private key and public key are different. A symmetrical schema is like if you password protect a zip file, you use the same password to decrypt it. Obviously this wouldn’t work in the real world of secure communication because how do you safely send the password to the intended recipient without it being intercepted?

To understand the basic functionality imagine the work it would require to figure out the product of the following:

2x9x11x1249x4259x6317

The answer is 6,653,438,480,106

Super easy, you can do it with a pen and paper.

Now imagine how hard it would be to take the final number (6,653,438,480,106) and determine the numbers that were multiplied to achieve it (2,9,11,1249,4259,6317).

There are so many possible ways to factor different numbers to arrive at 6,653,438,480,106 that it is currently computationally impossible.

2,9,11,1249,4259,6317 is your private key

6,653,438,480,106 is your public key

This is a crude example and not exactly how asymmetric encryption works but it demonstrates why it’s easy to multiply and verify a key, but practically impossible to factorize to find the original key.

Modern encryption uses elliptic curves as a method to generate public keys from private keys but that’s beyond the scope of this post.

As a side note a 256 bit number can be represented by a 16×16 grid. Each box in that grid is a bit. When drawn out it looks so simple and small and yet the possible combinations of filled and empty boxes in that grid is a number higher than the number of atoms in the universe. That’s mind boggling!

Anonymous 0 Comments

hashes are a fixed size.128, 256, etc bits for any length of input data. They are one-way function, multiple inputs can map to the same hash (but ideally very rare). It is ‘lossy’ in the terms of image compression. Information is lost.

Look at modulo (division remainder). 4+9 mod 7 = 13 mod 7 = 6

But also 21+6 mod 7 would == 6 as well, and 2+4 mod 7 etc

Encrypted data will be the same length as the input (assuming the algorithm doesn’t compress as well).

And if you do want compression you want to compress before you encrypt. Since compression looks for common patterns in the input, while encrypted data looks random, there are no common runs of identical strings or bytes.