~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/algorithm/sha1.h

  • Committer: Mark Atwood
  • Date: 2011-09-16 17:16:41 UTC
  • mfrom: (2409.3.4 rf)
  • Revision ID: me@mark.atwood.name-20110916171641-ri5n2bd1xsqi5jfb
mergeĀ lp:~olafvdspek/drizzle/refactor7

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <sys/types.h>
14
14
#include <string.h>
15
15
 
 
16
#include <drizzled/util/data_ref.h>
16
17
#include <drizzled/visibility.h>
17
18
 
18
 
namespace drizzled
19
 
{
 
19
namespace drizzled {
20
20
 
21
21
/**
22
22
 * @addtogroup sha1 SHA-1 in C
32
32
#define SHA1_DIGEST_LENGTH              20
33
33
#define SHA1_DIGEST_STRING_LENGTH       (SHA1_DIGEST_LENGTH * 2 + 1)
34
34
 
35
 
typedef class sha1_ctx{
 
35
class SHA1_CTX
 
36
{
36
37
public:
37
38
    uint32_t state[5];
38
39
    uint64_t count;
39
40
    uint8_t buffer[SHA1_BLOCK_LENGTH];
40
41
 
41
 
    sha1_ctx():
 
42
    SHA1_CTX() :
42
43
        count(0)
43
44
    {
44
45
      memset(state, 0, 5);
45
46
      memset(buffer, 0, SHA1_BLOCK_LENGTH);
46
47
    }
47
 
} SHA1_CTX;
 
48
};
48
49
 
49
 
DRIZZLED_API void SHA1Init(SHA1_CTX *);
50
 
DRIZZLED_API void SHA1Pad(SHA1_CTX *);
 
50
DRIZZLED_API void SHA1Init(SHA1_CTX*);
 
51
DRIZZLED_API void SHA1Pad(SHA1_CTX*);
51
52
DRIZZLED_API void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
52
 
DRIZZLED_API void SHA1Update(SHA1_CTX *, const uint8_t *, size_t);
53
 
DRIZZLED_API void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *);
 
53
DRIZZLED_API void SHA1Update(SHA1_CTX*, const uint8_t*, size_t);
 
54
DRIZZLED_API void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX*);
 
55
 
 
56
void do_sha1(data_ref, uint8_t[SHA1_DIGEST_LENGTH]);
54
57
 
55
58
/** @} */
56
59
 
57
60
} /* namespace drizzled */
58