Skip to main content
15 events
when toggle format what by license comment
Sep 30, 2016 at 14:19 comment added Douglas This point here isn't about SHA2, you could replace it with anything that gives you those properties.
Sep 30, 2016 at 14:03 comment added Douglas I understand and agree. I wouldn't be foolhardy to use it instead of proven standards. I thought you were saying that there were known ways of attacking it.
Sep 30, 2016 at 1:33 comment added Barmak Shemirani I don't know how to hack this, and I don't know the answer to your underlying question. I am just saying problems can exist in some areas. SHA-2 is not invincible. NIST has already picked SHA-3 successor. Concerns about SHA-2 are minor at this point. However, using SHA-2 for what it is not designed to do, can cause more problems. I don't imagine the above encryption could simply unravel, but it can have weaknesses. You may have concerns about AES because you hear reports about attacks on AES, but that just means AES is extensively tested for it is designed to accomplish.
Sep 29, 2016 at 14:59 comment added Douglas I don't see how you could attack it the ways you mentioned. Could you elaborate? If an attacker knows the plaintext, all he has access to is the value that was XORed with the plaintext, which was produced by SHA512(state + key), if he can discover the key from that, then SHA512 doesn't work.
Sep 29, 2016 at 0:29 comment added Barmak Shemirani By the way, there are other issues such as known-plaintext attack, chosen-plaintext attack, etc. AES is designed to deal with these attacks. Using SHA2 for encryption may work for a simple case, but may fail in other cases.
Sep 29, 2016 at 0:24 history edited Barmak Shemirani CC BY-SA 3.0
added 1548 characters in body
Sep 28, 2016 at 21:20 comment added Barmak Shemirani The mathematics of this is over my head. The obvious advantage is AES is faster, it has key expansion, it supports symmetric mode, it was designed for encryption and has been well studied in that regard. Perhaps you can ask crypto.stackexchange.com if there are some math related reasons that SHA-2 should not be used.
Sep 28, 2016 at 14:14 vote accept Douglas
Sep 28, 2016 at 14:13 comment added Douglas I benchmarked on a server and AES was indeed faster for blocksizes >= 1024 (imgur.com/cY9vAgR), so it's probably related to my system/hardware. What I was most interested in knowing though is if there are known ways of breaking the code.
Sep 28, 2016 at 0:39 comment added Barmak Shemirani Note that one of the purposes of SHA2 is to calculate the file's hash. For this purpose SHA2 won't do a full round from SHA2_init to SHA2_update to SHA2_final. Therefore SHA2 can hash a file faster than AES can encrypt a file. I am not familiar with OpenSSL, it looks like you are running some automated test which measures hash versus encryption, apples and oranges... I tested SHA512(in, in_size, out) versus 4 * AES_encrypt(in, out, key), AES was about 3 times faster without any major optimization.
Sep 27, 2016 at 22:39 comment added Douglas I used OpenSSL to measure performance: imgur.com/UO3pQPB and it very clearly shows that AES is slower. Since everyone keeps saying that SHA512 is slower, maybe there's something about the version I'm using or AES became much faster on newer computers? I don't have access to another machine now, maybe you would be kind enough to run on your PC and let me know the results?
Sep 27, 2016 at 5:00 history edited Barmak Shemirani CC BY-SA 3.0
added 146 characters in body
Sep 27, 2016 at 3:44 history edited Barmak Shemirani CC BY-SA 3.0
deleted 1 character in body
Sep 27, 2016 at 3:37 review First posts
Sep 27, 2016 at 8:32
Sep 27, 2016 at 3:36 history answered Barmak Shemirani CC BY-SA 3.0