From 23d01a2d9de8c89afe0417512ffa82826c4a6f03 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 28 Oct 2013 10:14:46 -0700 Subject: example of how to use hashes --- docs/hazmat/primitives/cryptographic-hashes.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst') diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index de66b7fe..8f1d342f 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -12,10 +12,19 @@ Message Digests .. class:: BaseHash(data=None) - Abstract base class that implements a common interface for all hash - algorithms that follow here. + Abstract base class that implements a common interface for all hash + algorithms that follow here. - If ``data`` is provided ``update(data)`` is called upon construction. + If ``data`` is provided ``update(data)`` is called upon construction. + + .. doctest:: + + >>> from cryptography.hazmat.primitives import hashes + >>> digest = hashes.SHA256() + >>> digest.update(b"abc") + >>> digest.update(b"123") + >>> digest.hexdigest() + '6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090' .. method:: update(data) -- cgit v1.2.3