GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You can write a prog/script that will generate it's own hash as output, but if you put the result back inside the file as a literal, that will of course change the file's hash.
The only way to avoid this would be to write the algorithm to search the data for an occurrence of the known hash-string, or perhaps for a set of markers surrounding it, and to omit those bytes from the hash calculation: hashing first the bytes leading up to the marker, then the bytes following it.
The only way to avoid this would be to write the algorithm to search the data for an occurrence of the known hash-string, or perhaps for a set of markers surrounding it, and to omit those bytes from the hash calculation: hashing first the bytes leading up to the marker, then the bytes following it.
Interesting idea! I would never think of that. Thank you.
Is it possible for a container to contain the hash of its own content?
For example, a document (PDF or any format) states among other things:
"The md5 hash of this document is ed4f489876105b369cc7628fc3841579"
Then you run the file/document through md5sum and get ed4f489876105b369cc7628fc3841579.
It's possible in the sense that there is some string which you could append to "The md5 hash of this document is ed4f489876105b369cc7628fc3841579" in order to make the statement true. However, finding the string for existing cryptographic algorithms is intractible (finding it would constitute a successful Preimage attack). It should be doable with crc32 or something like that though.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.