File: raw_hash.rst

package info (click to toggle)
python-libnacl 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: python: 2,634; makefile: 149; sh: 3
file content (23 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
==================
Raw Hash Functions
==================

The nacl library comes with sha256 and sha512 hashing libraries. They do not
seem to offer any benefit over python's hashlib, but for completeness they are
included. Creating a hash of a message is very simple:

.. code-block:: python

    import libnacl

    msg = 'Is there someone else up there we could talk to?'
    h_msg = libnacl.crypto_hash(msg)

crypto_hash defaults to sha256, sha512 is also available:

.. code-block:: python

    import libnacl

    msg = 'Is there someone else up there we could talk to?'
    h_msg = libnacl.crypto_hash_sha512(msg)