md4.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*!
  2. \ingroup MD4
  3. \brief This function initializes md4. This is automatically
  4. called by wc_Md4Hash.
  5. \return 0 Returned upon successfully initializing
  6. \param md4 pointer to the md4 structure to use for encryption
  7. _Example_
  8. \code
  9. md4 md4[1];
  10. if ((ret = wc_InitMd4(md4)) != 0) {
  11. WOLFSSL_MSG("wc_Initmd4 failed");
  12. }
  13. else {
  14. wc_Md4Update(md4, data, len);
  15. wc_Md4Final(md4, hash);
  16. }
  17. \endcode
  18. \sa wc_Md4Hash
  19. \sa wc_Md4Update
  20. \sa wc_Md4Final
  21. */
  22. void wc_InitMd4(Md4*);
  23. /*!
  24. \ingroup MD4
  25. \brief Can be called to continually hash the provided byte array
  26. of length len.
  27. \return 0 Returned upon successfully adding the data to the digest.
  28. \param md4 pointer to the md4 structure to use for encryption
  29. \param data the data to be hashed
  30. \param len length of data to be hashed
  31. _Example_
  32. \code
  33. md4 md4[1];
  34. byte data[] = { }; // Data to be hashed
  35. word32 len = sizeof(data);
  36. if ((ret = wc_InitMd4(md4)) != 0) {
  37. WOLFSSL_MSG("wc_Initmd4 failed");
  38. }
  39. else {
  40. wc_Md4Update(md4, data, len);
  41. wc_Md4Final(md4, hash);
  42. }
  43. \endcode
  44. \sa wc_Md4Hash
  45. \sa wc_Md4Final
  46. \sa wc_InitMd4
  47. */
  48. void wc_Md4Update(Md4* md4, const byte* data, word32 len);
  49. /*!
  50. \ingroup MD4
  51. \brief Finalizes hashing of data. Result is placed into hash.
  52. \return 0 Returned upon successfully finalizing.
  53. \param md4 pointer to the md4 structure to use for encryption
  54. \param hash Byte array to hold hash value.
  55. _Example_
  56. \code
  57. md4 md4[1];
  58. if ((ret = wc_InitMd4(md4)) != 0) {
  59. WOLFSSL_MSG("wc_Initmd4 failed");
  60. }
  61. else {
  62. wc_Md4Update(md4, data, len);
  63. wc_Md4Final(md4, hash);
  64. }
  65. \endcode
  66. \sa wc_Md4Hash
  67. \sa wc_Md4Final
  68. \sa wc_InitMd4
  69. */
  70. void wc_Md4Final(Md4* md4, byte* hash);