md5.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef _MD5_H_
  2. #define _MD5_H_
  3. /*
  4. * Copyright (C) 2009 by Thermotemp GmbH. All rights reserved.
  5. *
  6. * This code is based on a public domain implementation of md5.c by
  7. * Colin Plumb, June 1993
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THERMOTEMP GMBH AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THERMOTEMP
  26. * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. */
  37. /*!
  38. * \addtogroup xgHashes
  39. */
  40. /*@{*/
  41. #include <stdint.h>
  42. #include <sys/types.h>
  43. /*!
  44. * \file gorp/hashes/md5.h
  45. * \brief MD5 hash implementation
  46. */
  47. /*!
  48. * \struct MD5CONTEXT md5.h
  49. * \brief MD5 context structure.
  50. */
  51. typedef struct _MD5CONTEXT {
  52. uint32_t buf[4];
  53. uint32_t bits[2];
  54. uint8_t in[64];
  55. } MD5CONTEXT;
  56. void NutMD5Init(MD5CONTEXT *context);
  57. void NutMD5Update(MD5CONTEXT *context, uint8_t const *buf, uint32_t len);
  58. void NutMD5Final(MD5CONTEXT *context, uint8_t digest[16]);
  59. /*@}*/
  60. #endif