~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/algorithm/sha1.h

  • Committer: Monty Taylor
  • Date: 2009-02-08 10:59:43 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mordred@inaugust.com-20090208105943-e30tagctq2nrghxi
Renamed my_net_* to drizzleclient_net_* to help with namespace issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2010 nobody (this is public domain)
3
 
 */
4
 
 
5
 
/**
6
 
 * @file
7
 
 * @brief SHA1 Declarations
8
 
 */
9
 
 
10
 
#ifndef DRIZZLED_ALGORITHM_SHA1_H
11
 
#define DRIZZLED_ALGORITHM_SHA1_H
12
 
 
13
 
#include <stdint.h>
14
 
#include <sys/types.h>
15
 
#include <string.h>
16
 
 
17
 
namespace drizzled
18
 
{
19
 
 
20
 
/**
21
 
 * @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
 
 *
27
 
 * @{
28
 
 */
29
 
 
30
 
#define SHA1_BLOCK_LENGTH               64
31
 
#define SHA1_DIGEST_LENGTH              20
32
 
#define SHA1_DIGEST_STRING_LENGTH       (SHA1_DIGEST_LENGTH * 2 + 1)
33
 
 
34
 
typedef class sha1_ctx{
35
 
public:
36
 
    uint32_t state[5];
37
 
    uint64_t count;
38
 
    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
 
} SHA1_CTX;
47
 
 
48
 
void SHA1Init(SHA1_CTX *);
49
 
void SHA1Pad(SHA1_CTX *);
50
 
void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
51
 
void SHA1Update(SHA1_CTX *, const uint8_t *, size_t);
52
 
void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *);
53
 
 
54
 
/** @} */
55
 
 
56
 
} /* namespace drizzled */
57
 
 
58
 
#endif /* DRIZZLED_ALGORITHM_SHA1_H */