SHA256Print.c.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. SHA256Print.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='SHA256Match.c.html' title=' SHA256Match.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='SHA256Reset.c.html' title=' SHA256Reset.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * void SHA256Print (const uint8_t digest [], const char * string);
  24. *
  25. * HPAVKey.h
  26. *
  27. * print a digest in hexadecimal on stdout followed by string if
  28. * string is non-empty;
  29. *
  30. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  31. * Copyright (c) 2001-2006 by Charles Maier Associates;
  32. * Licensed under the Internet Software Consortium License;
  33. *
  34. *--------------------------------------------------------------------*/
  35. #ifndef SHA256PRINT_SOURCE
  36. #define SHA256PRINT_SOURCE
  37. #include &lt;stdio.h&gt;
  38. #include &quot;../key/SHA256.h&quot;
  39. #include &quot;../tools/number.h&quot;
  40. void SHA256Print (const uint8_t digest [], const char * string)
  41. {
  42. unsigned length = SHA256_DIGEST_LENGTH;
  43. while (length--)
  44. {
  45. putc (DIGITS_HEX [(* digest &gt;&gt; 4) &amp; 0x0F], stdout);
  46. putc (DIGITS_HEX [(* digest &gt;&gt; 0) &amp; 0x0F], stdout);
  47. digest++;
  48. }
  49. if (string) for (putc (' ', stdout); *string; string++)
  50. {
  51. putc (*string, stdout);
  52. }
  53. printf (&quot;\n&quot;);
  54. return;
  55. }
  56. #endif
  57. </pre>
  58. <div class='footerlink'>
  59. [<a href='SHA256Match.c.html' title=' SHA256Match.c '>PREV</a>]
  60. [<a href='toolkit.html' title=' Index '>HOME</a>]
  61. [<a href='SHA256Reset.c.html' title=' SHA256Reset.c '>NEXT</a>]
  62. </div>
  63. </body>
  64. </html>