Skip to content
Snippets Groups Projects
Select Git revision
  • 2196c116904097004f67f63f3b7ddee158ec95cd
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
41 results

README.md

Blame
    • Hugo Trentesaux's avatar
      1d2bb1b9
      Document pallets in readme (!122) · 1d2bb1b9
      Hugo Trentesaux authored
      * improve authority doc
      
      * more doc
      
      * update onshot accounts readme
      
      * doc xtask
      
      * doc runtime
      
      * doc todo
      
      * doc todo
      
      * doc pallets
      
      * doc todo
      
      * doc ud
      
      * doc oneshot
      
      * doc authority members
      
      * doc certification
      
      * doc wot
      
      * doc membership
      
      * doc identity
      
      * fix typo
      
      * doc duniter-account
      1d2bb1b9
      History
      Document pallets in readme (!122)
      Hugo Trentesaux authored
      * improve authority doc
      
      * more doc
      
      * update onshot accounts readme
      
      * doc xtask
      
      * doc runtime
      
      * doc todo
      
      * doc todo
      
      * doc pallets
      
      * doc todo
      
      * doc ud
      
      * doc oneshot
      
      * doc authority members
      
      * doc certification
      
      * doc wot
      
      * doc membership
      
      * doc identity
      
      * fix typo
      
      * doc duniter-account
    test_hash.py 2.05 KiB
    import pytest
    
    import nacl
    import nacl.encoding
    
    
    @pytest.mark.parametrize(("inp", "expected"), [
        (
            b"The quick brown fox jumps over the lazy dog.",
            b"ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c",
        ),
        (
            b"",
            b"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
        )
    ])
    def test_sha256_hex(inp, expected):
        assert nacl.hash.sha256(inp) == expected
    
    
    @pytest.mark.parametrize(("inp", "expected"), [
        (
            b"The quick brown fox jumps over the lazy dog.",
            b"\xEFS\x7F%\xC8\x95\xBF\xA7\x82Re)\xA9\xB6=\x97\xAAc\x15d\xD5\xD7\x89\xC2\xB7eD\x8C\x865\xFBl",
        ),
        (
            b"",
            b"\xe3\xb0\xc4B\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99o\xb9$'\xaeA\xe4d\x9b\x93L\xa4\x95\x99\x1bxR\xb8U",
        )
    ])
    def test_sha256_binary(inp, expected):
        assert nacl.hash.sha256(inp, encoder=nacl.encoding.RawEncoder) == expected
    
    
    @pytest.mark.parametrize(("inp", "expected"), [
        (
            b"The quick brown fox jumps over the lazy dog.",
            b"91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bbc6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed",
        ),
        (
            b"",
            b"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
        )
    ])
    def test_sha512_hex(inp, expected):
        assert nacl.hash.sha512(inp) == expected
    
    
    @pytest.mark.parametrize(("inp", "expected"), [
        (
            b"The quick brown fox jumps over the lazy dog.",
            b"\x91\xEA\x12E\xF2\rF\xAE\x9A\x03z\x98\x9FT\xF1\xF7\x90\xF0\xA4v\a\xEE\xB8\xA1M\x12\x89\f\xEAw\xA1\xBB\xC6\xC7\xED\x9C\xF2\x05\xE6{\x7F+\x8F\xD4\xC7\xDF\xD3\xA7\xA8a~E\xF3\xC4c\xD4\x81\xC7\xE5\x86\xC3\x9A\xC1\xED",
        ),
        (
            b"",
            b"\xCF\x83\xE15~\xEF\xB8\xBD\xF1T(P\xD6m\x80\a\xD6 \xE4\x05\vW\x15\xDC\x83\xF4\xA9!\xD3l\xE9\xCEG\xD0\xD1<]\x85\xF2\xB0\xFF\x83\x18\xD2\x87~\xEC/c\xB91\xBDGAz\x81\xA582z\xF9'\xDA>",
        )
    ])
    def test_sha512_binary(inp, expected):
        assert nacl.hash.sha512(inp, encoder=nacl.encoding.RawEncoder) == expected