hash - Second preimage resistance using MD4 AND MD5 -
let's have following:
- string: str
- md4 hash of string: md4(str)
- md5 hash of string: md5(str)
md4 , md5 cryptographically "broken" algorithms, meaning not difficult to:
1) find str_2 md4(str) = md4(str_2) (i.e. attack on md4)
2) find str_3 md5(str) = md5(str_3) (i.e. attack on md5)
how hard to:
3) find str_4 md4(str) = md4(str_4) and md5(str) = md5(str_4)
(i.e. attack on md4 , md5 simultaneously)?
obvious (probably not efficient) way to:
1) find string str md4(str) = md4(str)
2) check if md5(str) = md5(str)
3) if so, we're done. if not, go step 1 , satisfy step 1 different string.
above algorithm doesn't seem fast me (or it?). true string hashed both md4 , md5 quite safe second preimage attack?
edit:
(1) main concern enhancing second pre-image resistance
(2) main motivation not use outdated hashes today's applications. rather, two-fold: first, anticipating day hashes considered secure today become broken. example, if use sha-2, day becomes broken same day become worried data. if use sha-2 , bcrypt, if both become individually broken, may still unfeasible defeat second pre-image resistance of concat(sha2_hash, bcrypt_hash). second, want reduce chance of accidental collision (server thinks 2 inputs same because 2 hashes happens same)
this sort of thing doesn't improve security as think. resulting (m+n) bit value weaker output of hash natively generates (m+n) bits of output. answer on crypto.stackexchange.com goes little deeper if want know more details.
but bottom line when constructing hash function output concatenation of other hash functions, output is, @ best, strong strongest constituent hash.
and have ask why use md4 or md5 , go trouble begin with? use sha-3. if want feel "extra safe" calculate margin of safety feel comfortable with, , increase percentage. is, if feel 384 bits enough, go 512.
so, more information trying do, use file contents generate both "quick checksum" value , generate unique locator/identifier file @ same time still think choosing single hash better approach.
if insist on using 2 hash functions, submit instead of concatenating 2 hashes better approach instead use hmac using 2 different hash functions/algorithms. please note, not have rigorous proof works better, or construct won't generate horrible output. take grain of salt:
let h1
, h2
2 cryptographically secure hash functions, , let p
input data. then, hash & file identifier file given construct:
hmac (k,p) = h1((kgen(p) ⊕ pad1) ∥ h1((kgen(p) ⊕ pad2) ∥ p)))
where
kgen (p) = h2(p)
Comments
Post a Comment