Search results

There are no results.

std.crypto.md5

An implementation of the MD5 hash function.

MD5 is not cryptographically secure and you should avoid using it whenever possible.

The implementation is based on RFC 1321 and the pseudo code found at https://en.wikipedia.org/wiki/MD5#Pseudocode.

Examples

import std.crypto.md5 (Md5)

let hasher = Md5.new

hasher.write('hello'.to_byte_array)
hasher.finish.to_string # => '5d41402abc4b2a76b9719d911017c592'

You can also use Md5.hash:

import std.crypto.md5 (Md5)

Md5.hash('hello'.to_byte_array).to_string # => '5d41402abc4b2a76b9719d911017c592'

Limitations

The implementation of MD5 uses a 64-bits signed integer for tracking the total message size in bytes. This limits the total message size to 1024 PiB.

Classes

Md5

An MD5 hasher.