Module for computing MD5 checksums.
This module also works at compile time and in JavaScript.
See also
- base64 module for a Base64 encoder and decoder
- std/sha1 module for the SHA-1 checksum algorithm
- hashes module for efficient computations of hash values for diverse Nim types
Types
MD5Context {.final.} = object state: MD5State count: array[0 .. 1, uint32] buffer: MD5Buffer
- Source Edit
Procs
proc md5Final(c: var MD5Context; digest: var MD5Digest) {....raises: [], tags: [], gcsafe, forbids: [].}
-
Finishes the MD5Context and stores the result in digest.
If you use the toMD5 proc, there's no need to call this function explicitly.
Source Edit proc md5Init(c: var MD5Context) {....raises: [], tags: [], gcsafe, forbids: [].}
-
Initializes an MD5Context.
If you use the toMD5 proc, there's no need to call this function explicitly.
Source Edit proc md5Update(c: var MD5Context; input: cstring; len: int) {....raises: [], tags: [], gcsafe, forbids: [].}
-
Updates the MD5Context with the input data of length len.
If you use the toMD5 proc, there's no need to call this function explicitly.
Source Edit proc md5Update(c: var MD5Context; input: openArray[uint8]) {....raises: [], tags: [], gcsafe, forbids: [].}
-
Updates the MD5Context with the input data.
If you use the toMD5 proc, there's no need to call this function explicitly.
Source Edit proc toMD5(s: string): MD5Digest {....raises: [], tags: [], forbids: [].}
-
Computes the MD5Digest value for a string s.
See also:
- getMD5 proc which returns a string representation of the MD5Digest
- $ proc for converting MD5Digest to string
Example:
assert $toMD5("abc") == "900150983cd24fb0d6963f7d28e17f72"
Source Edit