2
0

md5.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /*
  17. * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
  18. * MD5 Message-Digest Algorithm (RFC 1321).
  19. *
  20. * Homepage:
  21. * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
  22. *
  23. * Author:
  24. * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
  25. *
  26. * This software was written by Alexander Peslyak in 2001. No copyright is
  27. * claimed, and the software is hereby placed in the public domain.
  28. * In case this attempt to disclaim copyright and place the software in the
  29. * public domain is deemed null and void, then the software is
  30. * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
  31. * general public under the following terms:
  32. *
  33. * Redistribution and use in source and binary forms, with or without
  34. * modification, are permitted.
  35. *
  36. * There's ABSOLUTELY NO WARRANTY, express or implied.
  37. *
  38. * See md5.c for more information.
  39. */
  40. #ifndef _LIBUBOX_MD5_H
  41. #define _LIBUBOX_MD5_H
  42. #include <stdint.h>
  43. #include <stddef.h>
  44. typedef struct md5_ctx {
  45. uint32_t lo, hi;
  46. uint32_t a, b, c, d;
  47. unsigned char buffer[64];
  48. } md5_ctx_t;
  49. extern void md5_begin(md5_ctx_t *ctx);
  50. extern void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
  51. extern void md5_end(void *resbuf, md5_ctx_t *ctx);
  52. int md5sum(const char *file, void *md5_buf);
  53. #endif