/External/Mysql-5.0/include/sha1.h

http://awoe.googlecode.com/ · C++ Header · 66 lines · 22 code · 10 blank · 34 comment · 0 complexity · 97c724bc3b9ac658e57c3ee4e0c524d5 MD5 · raw file

  1. /* Copyright (C) 2002, 2006 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /*
  13. This is the header file for code which implements the Secure
  14. Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
  15. April 17, 1995.
  16. Many of the variable names in this code, especially the
  17. single character names, were used because those were the names
  18. used in the publication.
  19. Please read the file sha1.c for more information.
  20. Modified 2002 by Peter Zaitsev to better follow MySQL standards
  21. */
  22. enum sha_result_codes
  23. {
  24. SHA_SUCCESS = 0,
  25. SHA_NULL, /* Null pointer parameter */
  26. SHA_INPUT_TOO_LONG, /* input data too long */
  27. SHA_STATE_ERROR /* called Input after Result */
  28. };
  29. #define SHA1_HASH_SIZE 20 /* Hash size in bytes */
  30. /*
  31. This structure will hold context information for the SHA-1
  32. hashing operation
  33. */
  34. typedef struct SHA1_CONTEXT
  35. {
  36. ulonglong Length; /* Message length in bits */
  37. uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */
  38. int Computed; /* Is the digest computed? */
  39. int Corrupted; /* Is the message digest corrupted? */
  40. int16 Message_Block_Index; /* Index into message block array */
  41. uint8 Message_Block[64]; /* 512-bit message blocks */
  42. } SHA1_CONTEXT;
  43. /*
  44. Function Prototypes
  45. */
  46. C_MODE_START
  47. int mysql_sha1_reset(SHA1_CONTEXT*);
  48. int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
  49. int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
  50. C_MODE_END