~drizzle-trunk/drizzle/development

1337.4.3 by Eric Day
Fixed sha1 cpplint issues.
1
/*
2
 * Copyright (C) 2010 nobody (this is public domain)
3
 */
4
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
5
/**
6
 * @file
7
 * @brief SHA1 Declarations
8
 */
9
1337.5.4 by Eric Day
FIxed header guards.
10
#ifndef DRIZZLED_ALGORITHM_SHA1_H
11
#define DRIZZLED_ALGORITHM_SHA1_H
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
12
13
#include <stdint.h>
14
#include <sys/types.h>
1843.4.1 by tdavies
File: drizzled/algorithm/sha1.h; Gave the anonymous struct a name and changed it to a c++ class, and added constructor.
15
#include <string.h>
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
16
17
namespace drizzled
18
{
19
20
/**
21
 * @addtogroup sha1 SHA-1 in C
22
 * By Steve Reid <steve@edmweb.com>
23
 * 100% Public Domain
24
 * @{
25
 */
26
27
#define	SHA1_BLOCK_LENGTH		64
28
#define	SHA1_DIGEST_LENGTH		20
29
#define	SHA1_DIGEST_STRING_LENGTH	(SHA1_DIGEST_LENGTH * 2 + 1)
30
1843.4.1 by tdavies
File: drizzled/algorithm/sha1.h; Gave the anonymous struct a name and changed it to a c++ class, and added constructor.
31
typedef class sha1_ctx{
32
public:
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
33
    uint32_t state[5];
34
    uint64_t count;
35
    uint8_t buffer[SHA1_BLOCK_LENGTH];
1843.4.1 by tdavies
File: drizzled/algorithm/sha1.h; Gave the anonymous struct a name and changed it to a c++ class, and added constructor.
36
37
    sha1_ctx():
38
    	count(0)
39
    {
40
      memset(state, 0, 5);
41
      memset(buffer, 0, SHA1_BLOCK_LENGTH);
42
    }
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
43
} SHA1_CTX;
44
45
void SHA1Init(SHA1_CTX *);
46
void SHA1Pad(SHA1_CTX *);
47
void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
48
void SHA1Update(SHA1_CTX *, const uint8_t *, size_t);
49
void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *);
50
51
/** @} */
52
53
} /* namespace drizzled */
54
1337.5.4 by Eric Day
FIxed header guards.
55
#endif /* DRIZZLED_ALGORITHM_SHA1_H */