~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/algorithm/sha1.h

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
#include <stdint.h>
14
14
#include <sys/types.h>
 
15
#include <string.h>
15
16
 
16
17
namespace drizzled
17
18
{
27
28
#define SHA1_DIGEST_LENGTH              20
28
29
#define SHA1_DIGEST_STRING_LENGTH       (SHA1_DIGEST_LENGTH * 2 + 1)
29
30
 
30
 
typedef struct {
 
31
typedef class sha1_ctx{
 
32
public:
31
33
    uint32_t state[5];
32
34
    uint64_t count;
33
35
    uint8_t buffer[SHA1_BLOCK_LENGTH];
 
36
 
 
37
    sha1_ctx():
 
38
        count(0)
 
39
    {
 
40
      memset(state, 0, 5);
 
41
      memset(buffer, 0, SHA1_BLOCK_LENGTH);
 
42
    }
34
43
} SHA1_CTX;
35
44
 
36
45
void SHA1Init(SHA1_CTX *);