ripemd.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* ripemd.h
  2. *
  3. * Copyright (C) 2006-2022 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /*!
  22. \file wolfssl/wolfcrypt/ripemd.h
  23. */
  24. #ifndef WOLF_CRYPT_RIPEMD_H
  25. #define WOLF_CRYPT_RIPEMD_H
  26. #include <wolfssl/wolfcrypt/types.h>
  27. #ifdef WOLFSSL_RIPEMD
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* in bytes */
  32. enum {
  33. RIPEMD = 3, /* hash type unique */
  34. RIPEMD_BLOCK_SIZE = 64,
  35. RIPEMD_DIGEST_SIZE = 20,
  36. RIPEMD_PAD_SIZE = 56
  37. };
  38. /* RipeMd 160 digest */
  39. typedef struct RipeMd {
  40. word32 buffLen; /* in bytes */
  41. word32 loLen; /* length in bytes */
  42. word32 hiLen; /* length in bytes */
  43. word32 digest[RIPEMD_DIGEST_SIZE / sizeof(word32)];
  44. word32 buffer[RIPEMD_BLOCK_SIZE / sizeof(word32)];
  45. } RipeMd;
  46. WOLFSSL_API int wc_InitRipeMd(RipeMd* ripemd);
  47. WOLFSSL_API int wc_RipeMdUpdate(RipeMd* ripemd, const byte* data, word32 len);
  48. WOLFSSL_API int wc_RipeMdFinal(RipeMd* ripemd, byte* hash);
  49. #ifdef __cplusplus
  50. } /* extern "C" */
  51. #endif
  52. #endif /* WOLFSSL_RIPEMD */
  53. #endif /* WOLF_CRYPT_RIPEMD_H */