~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/algorithm/sha1.h

  • Committer: Brian Aker
  • Date: 2010-09-09 21:45:53 UTC
  • mto: (1756.1.2 build) (1768.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1757.
  • Revision ID: brian@tangent.org-20100909214553-e687rmf5zk9478on
Force unique to just use memory and let the OS handle paging.

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>
16
15
 
17
16
namespace drizzled
18
17
{
19
18
 
20
19
/**
21
20
 * @addtogroup sha1 SHA-1 in C
22
 
 * 
23
 
 * This file is based on public domain code.
24
 
 * Initial source code is in the public domain, 
25
 
 * so clarified by Steve Reid <steve@edmweb.com>
26
 
 *
 
21
 * By Steve Reid <steve@edmweb.com>
 
22
 * 100% Public Domain
27
23
 * @{
28
24
 */
29
25
 
31
27
#define SHA1_DIGEST_LENGTH              20
32
28
#define SHA1_DIGEST_STRING_LENGTH       (SHA1_DIGEST_LENGTH * 2 + 1)
33
29
 
34
 
typedef class sha1_ctx{
35
 
public:
 
30
typedef struct {
36
31
    uint32_t state[5];
37
32
    uint64_t count;
38
33
    uint8_t buffer[SHA1_BLOCK_LENGTH];
39
 
 
40
 
    sha1_ctx():
41
 
        count(0)
42
 
    {
43
 
      memset(state, 0, 5);
44
 
      memset(buffer, 0, SHA1_BLOCK_LENGTH);
45
 
    }
46
34
} SHA1_CTX;
47
35
 
48
36
void SHA1Init(SHA1_CTX *);