How do you embed a hash into a file recursively?

Posted by oasisbob on Stack Overflow See other posts from Stack Overflow or by oasisbob
Published on 2010-05-07T23:34:40Z Indexed on 2010/05/07 23:38 UTC
Read the original article Hit count: 151

Filed under:

Simplest case: You want to make a text file which says "The MD5 hash of this file is FOOBARHASH". How do you embed the hash, knowing that the embedded hash value and the hash of the file are inter-related?

eg, Cisco embeds hash values into their IOS images, which can be verified like this:

cisco# verify s72033-advipservicesk9_wan-mz.122-33.SXH7.bin

Embedded Hash MD5 : D2BB0668310392BAC803BE5A0BCD0C6A
Computed Hash MD5 : D2BB0668310392BAC803BE5A0BCD0C6A

IIRC, Ubuntu also includes a txt file in the root of their ISOs which have the hash of the entire ISO.

Maybe I'm mistaken, but trying to figure out how to do this blows my mind.

© Stack Overflow or respective owner

Related posts about hashing