Go to the documentation of this file.00001
00002
00003
00004
00010 #pragma once
00011
00012 #include <stdint.h>
00013 #include <sys/types.h>
00014 #include <string.h>
00015
00016 #include <drizzled/util/data_ref.h>
00017 #include <drizzled/visibility.h>
00018
00019 namespace drizzled {
00020
00031 #define SHA1_BLOCK_LENGTH 64
00032 #define SHA1_DIGEST_LENGTH 20
00033 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
00034
00035 class SHA1_CTX
00036 {
00037 public:
00038 uint32_t state[5];
00039 uint64_t count;
00040 uint8_t buffer[SHA1_BLOCK_LENGTH];
00041
00042 SHA1_CTX() :
00043 count(0)
00044 {
00045 memset(state, 0, 5);
00046 memset(buffer, 0, SHA1_BLOCK_LENGTH);
00047 }
00048 };
00049
00050 DRIZZLED_API void SHA1Init(SHA1_CTX*);
00051 DRIZZLED_API void SHA1Pad(SHA1_CTX*);
00052 DRIZZLED_API void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
00053 DRIZZLED_API void SHA1Update(SHA1_CTX*, const uint8_t*, size_t);
00054 DRIZZLED_API void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX*);
00055
00056 void do_sha1(data_ref, uint8_t[SHA1_DIGEST_LENGTH]);
00057
00060 }