Score:-1

Can someone please explain the "secret" and the "data" in the MD5 hashing algorithm?

uz flag

I've been studying the MD5 hashing algorithm, and there is something that I just don't understand yet. They say that the server holds some sort or "secret" and that it appends some sort of "message" (or "data") to that secret. Then, the algorithm adds the appropriate padding to the concatenated ("secret" + "data") and the process continues from there. Now, it is said that only the server knows the "secret", but an attacker would know the "data" as well as the signature (which is apparently the result that comes out of hashing ("secret + data")). Now, here is what I don't get:

Let's say we have a URL:

http://website.com/ABCDEFGHIJKLMNOP?parameter=something

Now, the ABCDEFGHIJKLMNOP part is the hashed part of this URL. Would it be correct to call that part the signature? If so, what exactly is the "data" that an attacker supposedly knows? Where in this URL is the "data" that was appended to the "secret"?

Also, why is "data" appended to the "secret" in the first place? Why isn't the "secret" just hashed by itself and kept hidden from an attacker instead of giving the attacker some apparently known "data"?

fgrieu avatar
ng flag
One thing is sure: MD5 itself does not suppose that anything is secret, nor does it specifies a "server" entity. MD5 is a fully public function that transforms a message (any bitstring up to some extremely large size) into a 128-bit bitstring. That the message is secret, or not, has nothing to do with MD5 itself. A sure thing is that if the hash is to be secret, at least some of the message must be. The question is about MD5 in some context that is currently unclear. The mention of "signature" suggests something more complex than HMAC or password hashing. We can't tel!!
ph flag
A link to a resource that makes this claim would be helpful. As fgrieu says, the claim isn't true about MD5 per se, but it could be correct in a larger context. As for a url, the significance of the parts is up to the creator - you can't tell in general if there are hashes involved at all. And in any case, "the hashed part of the url" doesn't mean much.
Rikudou avatar
uz flag
@bmm6o Here is a link that mentions what I mean about the "secret" and the "data" and all of that: https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks
jp flag
@Rikudou That article is about attacking a badly-designed [message authentication code](https://en.wikipedia.org/wiki/Message_authentication_code) (MAC) algorithm *based on* MD5 (or some other extendable hash). The "secret" and "data" parts come from it being used as a MAC, not from MD5 itself.
fgrieu avatar
ng flag
In proper _signature_, there is a private key used to produce the signature, and a public key to verify the signature. Nothing such in the [case at hand](https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks).
Score:1
in flag

As indicated, this is about creating a $\operatorname{MAC}_k(m) = \operatorname{H}(k \| m)$ where $k$ is the key / secret and $m$ is the message / data.

Now, the ABCDEFGHIJKLMNOP part is the hashed part of this URL. Would it be correct to call that part the signature? If so, what exactly is the "data" that an attacker supposedly knows?

No, "ABCDEFGHIJKLMNOP" is the message data. The attacker knows it because it is plainly displayed in the URL.

Also, why is "data" appended to the "secret" in the first place? Why isn't the "secret" just hashed by itself and kept hidden from an attacker instead of giving the attacker some apparently known "data"?

Because the MAC is used to authenticate a message. If you just hash the secret then you could show that you have the key, but the data would be left unprotected.

In both cases you should still beware of replay attacks. However, that's another topic I suppose.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.