how can I set one md5 hash to multiple .ps files?
I know how to change md5 hash, but no idea how to set it to value which I would like to have.
To create two files with the same md5 hash you can have a look here https://natmchugh.blogspot.co.za/2014/10/how-i-made-two-php-files-with-same-md5.html?m=1 . The tricky part may be getting them to remain as valid PS files. In the example the author takes advantage of Pups language to add the differing text in such a way the syntax remains correct. Perhaps in a PS text section. Also have a look at https://natmchugh.blogspot.co.za/2015/05/how-to-make-two-binaries-with-same-md5.html?m=1
However usually you do not set the md5 hash but generate it from a file. This allows the recipient of the file to confirm it has not been corrupted by generating the md5 hash on their end and comparing with the one you gave them. If you are looking to generate one md5 hash for multiple files you could
Compress the files and generate the md5 hash from that file
Generate multiple md5 hashes and join them using an algorithm that always ensures the same value is produced from the hashes each time. For example concatenate the hashes or create an md5 hash of all the md5 hashes. The downside is whoever will use the hashes will also need to know the algorithm.
Have a look at Combine MD5 hashes of multiple files
Related
Lets say I have two files with two different sha1 hashes. Is there a way to change the hash of one file to the hash from the other file so they both have the same hash value?
The two files have different values in it.
Yes.
Either:
Change the content of the file so the two files are identical or
Find another set of data (you'll probably have to brute force search this so it would take a lot of computing power) which happens to hash to the same value
You can't change the hash without changing the content of the file. The hash is just what you get after doing some calculations on the content of the file.
I have a large file that I need to compress, however I need to ensure that the original file has the same hash value as the compressed one. I tried it on a smaller file, hash values are different but I am thinking that this might be because of metadata change. How do I ensure that the files don't change after compression?
It depends on which shash you are using. If you are using crc32 it's pretty trivial to make your hashes the same. MD5 might be possible already (I don't know the start of the art there), SHA1 will probably be doable in a few years. If you are using SHA256, better give up.
Snark about broken crypto aside, unless your hash algorithm knows specifically about your compression setup or your input file was very carefully crafted to provoke a hash collision: the hash will change before and after compression. That means any standard cryptographic hash will change upon compression.
All the hash algorithm sees are a stream of bits without any meaning. It does not know about compression schemes, and should not.
If your hash is a CRC-32, then you can insert or append four bytes to the compressed data, and set those to get the original CRC. For example, in a gzip stream you can insert a four-byte extra block in the header.
The whole point of cryptographic hashes, like MD5 noted as a tag to the question, is to make that exceedingly difficult, or practically impossible.
I'm having a hard time getting a straight answer on whether, say, an MD5 hash of a file is different from the hashed password to access said file.
For example, if one was trying a brute force attack against a hash taken from the file, would the result (if any) be usable as the password, or are these fundamentally different things?
Your password will probably be a shortish string, like "paSs!w0rd". Your file will be, say, a 1Mb document. These two are very different things. Because they are different their hashes are overwhelmingly likely to be different. Hash functions are deliberately designed so that different inputs will result in very different hashes. To show this, try comparing the MD5 hashes of "paSs!w0rd" and "paSs!w0rD" (with a capital D at the end).
This question already has answers here:
Decrypt MD5 hash [duplicate]
(5 answers)
Closed 5 years ago.
Does MD5 hashes the string or it encrypt it? If it hashes it, then it's as they say a one-way hash function and original string (or data) are non-recoverable by the hash produced because it's only for authentication. Then how can we explain the online websites for MD5 decryption? I actually tried it, it gets back the original string. And here's a site that does this: http://www.md5decrypter.co.uk/
How is this possible?
MD5 is a hash algorithm, meaning that it maps an arbitrary-length string to a string of some fixed length. The intent is to make it so that it is hard to start with the output of an MD5 hash and to recover some particular input that would hash to that output. Because there are infinitely many strings and finitely many outputs, it is not an encryption function, and given just the output it's impossible to determine which input produced that output.
However, MD5 has many cryptographic weaknesses and has been superseded by a variety of other hash functions (the SHA family). I would strongly suggest not using MD5 if cryptographic security is desired, since there are much better algorithms out there.
Hope this helps!
MD5 is a cryptographic hash function. It maps a variable-length string to a 128-bit hash value. It's one-way but the code can be cracked quickly using Rainbow Tables. Not to mention the site you posted says it has
a total of just over 8.7 billion unique decrypted MD5 hashes...
so it can check against those first before it even needs to try to crack it.
They don't "decrypt", they find a string that matches your hash, which is not the same thing but when you limit yourself to common English words it could very well be.
To understand what's going on you have to consider the count of possible MD5 hashes - 2^128, which is more than the count of words in English (2^16?) but much less than all possible string values 2^(number of bits the internet has and then some)
When you convert from a smaller set into a bigger one (english->MD5) it's likely all values will be different, but the other way around isn't true.
Bottom line: use a password that isn't a string that can be found by google anywhere on the net.
Is it possible to generate a text file, the content of which is the file's hash/md5 value.
How to write the program?
If such a file exists, it is possible to generate it by trying every possible MD5 hash and checking if its MD5 hash equals it. But since all possible MD5 hashes are a finite set, such a special MD5 value might not even exist at all.
Note: you asked only if it's possible, not how much time it would take.
I was interested too, so i wrote following pascal program:
program hash;
uses md5;
var a, b: string;
begin
b:='d41d8cd98f00b204e9800998ecf8427e'; //md5sum of /dev/null
repeat
a:=md5Print(md5String(b));
b:=md5Print(md5String(a));
until a=b;
writeln(a);
writeln(b);
end.
It running for about five days already, but still no result yet)))
Note that if you wish to brute force it, trimethoxy's approach is fundamentally flawed. Each hash effectively points to another random hash, and as the series of hashes increases, it becomes increasingly more likely that any newly visited hash will simply point you back to a previously visited hash, forming a cycle millions or billions of hashes long.
If we assume that the entire hash space of MD5 is not a single cyclical loop, which is exceedingly unlikely, then nearly all values are in a competitively short cyclical loop that leaves the vast majority of MD5 hashes unvisited.
Basically, even if self mapped hashes exist, that approach is still more likely to simply put itself in an infinite loop than it is to actually find one.