crypto.md5 #
Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file. Package md5 implements the MD5 hash algorithm as defined in RFC 1321. MD5 is cryptographically broken and should not be used for secure applications. Based off: https://github.com/golang/go/blob/master/src/crypto/md5 Last commit: https://github.com/golang/go/commit/ed7f323c8f4f6bc61a75146bf34f5b8f73063a17
Constants #
const size = 16
The size of an MD5 checksum in bytes.
const block_size = 64
The blocksize of MD5 in bytes.
fn hexhash #
fn hexhash(s string) string
hexhash returns a hexadecimal MD5 hash sum string of s.
Example
assert md5.hexhash('V') == '5206560a306a2e085a437fd258eb57ce'
fn new #
fn new() &Digest
new returns a new Digest (implementing hash.Hash) computing the MD5 checksum.
fn sum #
fn sum(data []u8) []u8
sum returns the MD5 checksum of the data.
fn (Digest) free #
fn (mut d Digest) free()
free the resources taken by the Digest d
fn (Digest) reset #
fn (mut d Digest) reset()
reset the state of the Digest d
fn (Digest) write #
fn (mut d Digest) write(p_ []u8) !int
write writes the contents of p_ to the internal hash representation.
fn (Digest) sum #
fn (d &Digest) sum(b_in []u8) []u8
sum returns the md5 sum of the bytes in b_in.
fn (Digest) size #
fn (d &Digest) size() int
size returns the size of the checksum in bytes.
fn (Digest) block_size #
fn (d &Digest) block_size() int
block_size returns the block size of the checksum in bytes.