Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 777 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 777 Bytes

MD5 in Elixir

This is a implementation of the MD5 algorithm written in pure Elixir. The code was written as a learning exercise following the MD5 specification found here. MD5 is a fast general purpose hash it can be easily brute-forced by today's computing power. So definitely don't use it for anything you want to keep secure. However it can be useful to check for tampering or corruption in files or data (e.g. checksums).

Usage

Load the code in the Elixir REPL:

iex -S Mix

To calculate the MD5 hash:

iex(1)> Md5.digest("Hello world")
"3e25960a79dbc69b674cd4ec67a72c62"

To calculate the checksum of a file:

iex(1)> Md5.digest_file("./README.md")
"8b1d50c6e91ca212a8af9bab047de574"