Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove std/ prefix from doc/lib.rst now that canonical import is shown in module docs #17543

Merged
merged 2 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions doc/lib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ Algorithms
* `algorithm <algorithm.html>`_
This module implements some common generic algorithms like sort or binary search.

* `std/enumutils <enumutils.html>`_
* `enumutils <enumutils.html>`_
This module adds functionality for the built-in `enum` type.

* `sequtils <sequtils.html>`_
This module implements operations for the built-in `seq` type
which were inspired by functional programming languages.

* `std/setutils <setutils.html>`_
* `setutils <setutils.html>`_
This module adds functionality for the built-in `set` type.


Expand Down Expand Up @@ -125,7 +125,7 @@ Collections
* `options <options.html>`_
The option type encapsulates an optional value.

* `std/packedsets <packedsets.html>`_
* `packedsets <packedsets.html>`_
Efficient implementation of a set of ordinals as a sparse bit set.

* `sets <sets.html>`_
Expand All @@ -147,7 +147,7 @@ String handling
* `cstrutils <cstrutils.html>`_
Utilities for `cstring` handling.

* `std/editdistance <editdistance.html>`_
* `editdistance <editdistance.html>`_
This module contains an algorithm to compute the edit distance between two
Unicode strings.

Expand Down Expand Up @@ -197,14 +197,14 @@ String handling
It provides a single proc that does Unicode to ASCII transliterations.
Based on Python's Unidecode module.

* `std/wordwrap <wordwrap.html>`_
* `wordwrap <wordwrap.html>`_
This module contains an algorithm to wordwrap a Unicode string.


Time handling
-------------

* `std/monotimes <monotimes.html>`_
* `monotimes <monotimes.html>`_
The `monotimes` module implements monotonic timestamps.

* `times <times.html>`_
Expand Down Expand Up @@ -272,7 +272,7 @@ Math libraries
* `random <random.html>`_
Fast and tiny random number generator.

* `std/sysrand <sysrand.html>`_
* `sysrand <sysrand.html>`_
Cryptographically secure pseudorandom number generator.

* `rationals <rationals.html>`_
Expand All @@ -281,7 +281,7 @@ Math libraries
* `stats <stats.html>`_
Statistical analysis

* `std/sums <sums.html>`_
* `sums <sums.html>`_
Accurate summation functions.


Expand Down Expand Up @@ -357,7 +357,7 @@ Parsers
* `json <json.html>`_
High-performance JSON parser.

* `std/jsonutils <jsonutils.html>`_
* `jsonutils <jsonutils.html>`_
This module implements a hookable (de)serialization for arbitrary types.

* `lexbase <lexbase.html>`_
Expand Down Expand Up @@ -448,7 +448,7 @@ Hashing
produce a globally distributed unique ID. This implementation was extracted
from the Mongodb interface and it thus binary compatible with a Mongo OID.

* `std/sha1 <sha1.html>`_
* `sha1 <sha1.html>`_
This module implements a sha1 encoder and decoder.


Expand All @@ -465,7 +465,7 @@ Miscellaneous
* `coro <coro.html>`_
This module implements experimental coroutines in Nim.

* `std/enumerate <enumerate.html>`_
* `enumerate <enumerate.html>`_
This module implements `enumerate` syntactic sugar based on Nim's macro system.

* `logging <logging.html>`_
Expand All @@ -480,10 +480,10 @@ Miscellaneous
* `unittest <unittest.html>`_
Implements a Unit testing DSL.

* `std/varints <varints.html>`_
* `varints <varints.html>`_
Decode variable-length integers that are compatible with SQLite.

* `std/with <with.html>`_
* `with <with.html>`_
This module implements the `with` macro for easy function chaining.


Expand Down
27 changes: 10 additions & 17 deletions lib/std/sha1.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"

timotheecour marked this conversation as resolved.
Show resolved Hide resolved
import std/strutils
from std/endians import bigEndian32, bigEndian64

Expand Down