MD5: Difference between revisions
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* [[Cryptography#MD5|Cryptography]] | * [[Cryptography#MD5|Cryptography]] | ||
* [[SHA-1#Overview|SHA-1]] | |||
=Overview= | =Overview= | ||
MD5 is a cryptographically secure message digest algorithm. It takes an arbitrary-sized input - a byte array - and generates a fixed size output, called a ''digest'' or ''hash''. MD5 produces a 16 byte digest. | MD5 is a cryptographically secure message digest algorithm. It takes an arbitrary-sized input - a byte array - and generates a fixed size output, called a ''digest'' or ''hash''. MD5 produces a 16 byte digest (128 bit). | ||
=Computing MD5= | =Computing MD5= | ||
=OpenSSL= | ==OpenSSL== | ||
An MD5 hash can be [[Openssl_Operations#Generate_an_MD5_Hash|generated with OpenSSL]]. | An MD5 hash can be [[Openssl_Operations#Generate_an_MD5_Hash|generated with OpenSSL]]. | ||
==Java== | |||
{{External|https://github.com/NovaOrdis/playground/tree/master/java/security/encryption}} | |||
<syntaxhighlight lang='java'> | |||
import java.security.MessageDigest; | |||
public static byte[] getMD5(byte[] b) throws Exception { | |||
MessageDigest md = MessageDigest.getInstance("MD5"); | |||
return md.digest(b); | |||
} | |||
</syntaxhighlight> |
Latest revision as of 22:08, 26 August 2018
External
Internal
Overview
MD5 is a cryptographically secure message digest algorithm. It takes an arbitrary-sized input - a byte array - and generates a fixed size output, called a digest or hash. MD5 produces a 16 byte digest (128 bit).
Computing MD5
OpenSSL
An MD5 hash can be generated with OpenSSL.
Java
import java.security.MessageDigest;
public static byte[] getMD5(byte[] b) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
return md.digest(b);
}