0

I'm curious about some basics of MD5 encryption I couldn't get from Google, Java questions here nor a dense law paper:

1-How to measure, in bytes, an MD5 hash string? And does it depends if the string is UNICODE or ANSI?

2-Is MD5 an assymetric algorythm?

Example: If my app talks (http) to a REST webservice using a key (MD5_128 hash string, ANSI made of 9 chars) to unencrypt received data, does that account for 9x8=72 bytes in an assymetric algorithm?

I'm using Windevs 25 in Windows, using functions like Encrypt and HashString, but I lack knowledge about encryption.

Edit: Not asnwered yet, but it seems like I need to know more about charsets before jumping to hashes and encryption. https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

Youki
  • 33
  • 8

1 Answers1

1

An MD5 hash is 128 bits, 16 bytes. The result is binary, not text, so it is neither "ANSI" nor "Unicode". Like all hashes, it is asymmetric, which should be obvious from the fact that you can hash inputs which are longer than 128 bits. Since it is asymmetric, you cannot "unencrypt" (decrypt) it. This is by design and intentional.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Just as an additional note on the "binary-ness": The output of MD5 is just 16 bytes. But it is often *represented* as the hex-encoding of those 16 bytes, which is 32 hexadecimal digits. – Joachim Sauer Jan 28 '21 at 15:17
  • @JoachimSauer: Sure, but the question mentions "9x8=72 bytes". That does not make sense in any encoding. – MSalters Jan 28 '21 at 15:29
  • 1
    Regarding the second question, symmetric or asymmetric makes only sense for encryption or digital signature (sort of). Since there are no keys at play during hashing it also doesn't make sense to classify it as symmetric or asymmetric. Hash functions are used to create HMACs which would be symmetric. Hash functions are also used to create asymmetric digital signature algorithms such as SPHINCS+. – Artjom B. Jan 28 '21 at 22:48