Skip to content
Snippets Groups Projects
Select Git revision
  • 3e302cc00ebb7f73f34b5ab18feade51b64c3b74
  • master default protected
  • streebog
  • gost28147
  • master-updates
  • ed448
  • shake256
  • curve448
  • ecc-sqrt
  • gosthash94cp
  • cmac64
  • block16-refactor
  • siv-mode
  • cmac-layout
  • delete-des-compat
  • delete-rsa_blind
  • aes-struct-layout
  • release-3.4-fixes
  • struct-layout
  • attribute-deprecated
  • rename-data-symbols
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
  • nettle_2.7.1_release_20130528
  • nettle_2.7_release_20130424
  • nettle_2.6_release_20130116
  • nettle_2.5_release_20120707
41 results

nettle-benchmark.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    sha256-test.c 6.37 KiB
    #include "testutils.h"
    
    void
    test_main(void)
    {
      /* From FIPS180-2 */
      test_hash(&nettle_sha256, SDATA("abc"),
    	    SHEX("ba7816bf8f01cfea 414140de5dae2223"
    		 "b00361a396177a9c b410ff61f20015ad"));
    
      test_hash(&nettle_sha256,
    	    SDATA("abcdbcdecdefdefgefghfghighij"
    		  "hijkijkljklmklmnlmnomnopnopq"),
    	    SHEX("248d6a61d20638b8 e5c026930c3e6039"
    		 "a33ce45964ff2167 f6ecedd419db06c1"));
    
      test_hash(&nettle_sha256,
    	    SDATA("abcdefghbcdefghicdefghijdefg"
    		  "hijkefghijklfghijklmghijklmn"
    		  "hijklmnoijklmnopjklmnopqklmn"
    		  "opqrlmnopqrsmnopqrstnopqrstu"),
    	    SHEX("cf5b16a778af8380 036ce59e7b049237"
    		 "0b249b11e8f07a51 afac45037afee9d1"));
    
      /* Additional test vectors, from Daniel Kahn Gillmor */
      test_hash(&nettle_sha256, SDATA(""),
    	    SHEX("e3b0c44298fc1c14 9afbf4c8996fb924"
    		 "27ae41e4649b934c a495991b7852b855"));
      test_hash(&nettle_sha256, SDATA("a"),
    	    SHEX("ca978112ca1bbdca fac231b39a23dc4d"
    		 "a786eff8147c4e72 b9807785afee48bb"));
      test_hash(&nettle_sha256, SDATA("38"),
    	    SHEX("aea92132c4cbeb26 3e6ac2bf6c183b5d"
    		 "81737f179f21efdc 5863739672f0f470"));
      test_hash(&nettle_sha256, SDATA("message digest"),
    	    SHEX("f7846f55cf23e14e ebeab5b4e1550cad"
    		 "5b509e3348fbc4ef a3a1413d393cb650"));
      test_hash(&nettle_sha256, SDATA("abcdefghijklmnopqrstuvwxyz"),
    	    SHEX("71c480df93d6ae2f 1efad1447c66c952"
    		 "5e316218cf51fc8d 9ed832f2daf18b73"));
      test_hash(&nettle_sha256,
    	    SDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
    		  "ghijklmnopqrstuvwxyz0123456789"),
    	    SHEX("db4bfcbd4da0cd85 a60c3c37d3fbd880"
    		 "5c77f15fc6b1fdfe 614ee0a7c8fdb4c0"));
      test_hash(&nettle_sha256,
    	    SDATA("12345678901234567890123456789012"
    		  "34567890123456789012345678901234"
    		  "5678901234567890"),
    	    SHEX("f371bc4a311f2b00 9eef952dd83ca80e"
    		 "2b60026c8e935592 d0f9c308453c813e"));
    }
    
    /* These are intermediate values for the single sha1_compress call
       that results from the first testcase, SHA256("abc"). Each row are
       the values for A, B, C, D, E, F, G, H after the i:th round. The row
       i = -1 gives the initial values, and i = 99 gives the output
       values.
       
    -1: 6a09e667 bb67ae85 3c6ef372 a54ff53a 510e527f 9b05688c 1f83d9ab 5be0cd19
     0: 6a09e667 bb67ae85 3c6ef372 fa2a4622 510e527f 9b05688c 1f83d9ab 5d6aebcd
     1: 6a09e667 bb67ae85 78ce7989 fa2a4622 510e527f 9b05688c 5a6ad9ad 5d6aebcd
     6: 24e00850 e5030380 2b4209f5  4409a6a d550f666 9b27a401 714260ad 43ada245
     7: 85a07b5f e5030380 2b4209f5  4409a6a  c657a79 9b27a401 714260ad 43ada245
     8: 85a07b5f e5030380 2b4209f5 32ca2d8c  c657a79 9b27a401 714260ad 8e04ecb9
     9: 85a07b5f e5030380 1cc92596 32ca2d8c  c657a79 9b27a401 8c87346b 8e04ecb9
    14: 816fd6e9 c0645fde d932eb16 87912990 f71fc5a9  b92f20c 745a48de 1e578218
    15: b0fa238e c0645fde d932eb16 87912990  7590dcd  b92f20c 745a48de 1e578218
    16: b0fa238e c0645fde d932eb16 8034229c  7590dcd  b92f20c 745a48de 21da9a9b
    17: b0fa238e c0645fde 846ee454 8034229c  7590dcd  b92f20c c2fbd9d1 21da9a9b