diff options
Diffstat (limited to 'lib/std/sha1.nim')
-rw-r--r-- | lib/std/sha1.nim | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/std/sha1.nim b/lib/std/sha1.nim index b74b285f8..9c5efed1f 100644 --- a/lib/std/sha1.nim +++ b/lib/std/sha1.nim @@ -6,33 +6,26 @@ # See the file "copying.txt", included in this # distribution, for details about the copyright. # -## **Note:** Import `std/sha1` to use this module. -## ## [SHA-1 (Secure Hash Algorithm 1)](https://en.wikipedia.org/wiki/SHA-1) ## is a cryptographic hash function which takes an input and produces ## a 160-bit (20-byte) hash value known as a message digest. ## -## Basic usage -## =========== -## -runnableExamples: - let accessName = secureHash("John Doe") - assert $accessName == "AE6E4D1209F17B460503904FAD297B31E9CF6362" - -## .. code-block:: -## let -## a = secureHashFile("myFile.nim") -## b = parseSecureHash("10DFAEBF6BFDBC7939957068E2EFACEC4972933C") -## -## if a == b: -## echo "Files match" -## ## See also ## ======== ## * `base64 module<base64.html>`_ implements a Base64 encoder and decoder ## * `hashes module<hashes.html>`_ for efficient computations of hash values for diverse Nim types ## * `md5 module<md5.html>`_ implements the MD5 checksum algorithm +runnableExamples: + let accessName = secureHash("John Doe") + assert $accessName == "AE6E4D1209F17B460503904FAD297B31E9CF6362" + +runnableExamples("-r:off"): + let + a = secureHashFile("myFile.nim") + b = parseSecureHash("10DFAEBF6BFDBC7939957068E2EFACEC4972933C") + assert a == b, "files don't match" + import std/strutils from std/endians import bigEndian32, bigEndian64 |