Hot answers tagged

23

Hash random values until you get a hash with two leading zeroes. We would expect about 1 in 4 values to have a hash-value of that form. So let's try this: echo hello | sha1sum f572d396fae9206628714fb2ce00f72e94f2258f - Nope. echo hello1 | sha1sum 0ef562ff2d0c21358f9d289f1c908436714fc923 - There we are, 4 leading zeroes.


11

This is an extension of Maeher's answer and full code of this answer is in Github. Hash functions are expected to produce random output in a sense that random in the sense that the value of the hash is basically unpredictable without actual computing. We , also, expect them to produce the hash result evenly, i.e. all possible hash values occurs with the same ...


6

Could is also be possible to generate $H(\text{message}[1..n-1])$ from $H(\text{message}[1..n])$ if I know the last byte? No, the length extension attacks are not working exactly like that. Let see how MD5 operates; MD5 divides a message into 512-bit blocks to operate1 in Merkle–Damgård fashion way. Every message is padded. The messages are padded with 1 ...


3

No, currently not even MD5 is broken enough for this. MD5 and SHA-1/2 all use a simple Merkle-Damgard construction. In an MD construction basically what you get is (for a message split into two message blocks): $$H(M) = H'(H'(C, B'_1), B'_2)$$ where $C$ is a known constant and $B_i$ consists of the message blocks, with a padded last block. Now if $H'$ was ...


1

just bruteforce it; one possible way to do it in PHP would be: ... i'm not sure which way to count the bits, code to count them in both directions follows: <?php declare(strict_types = 1); $bit1_flag = 1 << 7; $bit2_flag = 1 << 6; // (and i know the fugly for loop should be a do{}while() instead, anyone feel free to fix it, idc) for ($i = 0; ...


Only top voted, non community-wiki answers of a minimum length are eligible