On this page
md5
Module for computing MD5 checksums.
See also:
- base64 module implements a base64 encoder and decoder
- std/sha1 module for a sha1 encoder and decoder
- hashes module for efficient computations of hash values for diverse Nim types
Types
-
MD5Digest = array[0 .. 15, uint8] - MD5 checksum of a string, obtained with toMD5 proc. Source Edit
-
MD5Context {...}{.final.} = object state: MD5State count: array[0 .. 1, uint32] buffer: MD5Buffer - Source Edit
Procs
-
proc toMD5(s: string): MD5Digest {...}{.raises: [], tags: [].} -
Computes the
MD5Digestvalue for a strings.See also:
- getMD5 proc which returns a string representation of the
MD5Digest - $ proc for converting MD5Digest to string
Example:
Source Editassert $toMD5("abc") == "900150983cd24fb0d6963f7d28e17f72" - getMD5 proc which returns a string representation of the
-
proc `$`(d: MD5Digest): string {...}{.raises: [], tags: [].} -
Converts a
MD5Digestvalue into its string representation. Source Edit -
proc getMD5(s: string): string {...}{.raises: [], tags: [].} -
Computes an MD5 value of
sand returns its string representation. .. note:: available at compile timeSee also:
- toMD5 proc which returns the
MD5Digestof a string
Example:
Source Editassert getMD5("abc") == "900150983cd24fb0d6963f7d28e17f72" - toMD5 proc which returns the
-
proc `==`(D1, D2: MD5Digest): bool {...}{.raises: [], tags: [].} -
Checks if two
MD5Digestvalues are identical. Source Edit -
proc md5Init(c: var MD5Context) {...}{.raises: [], tags: [], gcsafe.} -
Initializes a
MD5Context.If you use 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.} -
Updates the
MD5Contextwith theinputdata of lengthlen.If you use toMD5 proc there's no need to call this function explicitly.
Source Edit -
proc md5Final(c: var MD5Context; digest: var MD5Digest) {...}{.raises: [], tags: [], gcsafe.} -
Finishes the
MD5Contextand stores the result indigest.If you use toMD5 proc there's no need to call this function explicitly.
Source Edit
© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/md5.html