~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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
10
#pragma once
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
11
12
#include <stdint.h>
13
#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.
14
#include <string.h>
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
15
2409.3.1 by Olaf van der Spek
Add do_sha1()
16
#include <drizzled/util/data_ref.h>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
17
#include <drizzled/visibility.h>
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
18
2409.3.1 by Olaf van der Spek
Add do_sha1()
19
namespace drizzled {
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
20
21
/**
22
 * @addtogroup sha1 SHA-1 in C
1971.2.2 by kalebral at gmail
a few more updates of files that did not have license or had incorrect license structure
23
 * 
24
 * This file is based on public domain code.
25
 * Initial source code is in the public domain, 
26
 * so clarified by Steve Reid <steve@edmweb.com>
27
 *
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
28
 * @{
29
 */
30
31
#define	SHA1_BLOCK_LENGTH		64
32
#define	SHA1_DIGEST_LENGTH		20
33
#define	SHA1_DIGEST_STRING_LENGTH	(SHA1_DIGEST_LENGTH * 2 + 1)
34
2409.3.1 by Olaf van der Spek
Add do_sha1()
35
class SHA1_CTX
36
{
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.
37
public:
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
38
    uint32_t state[5];
39
    uint64_t count;
40
    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.
41
2409.3.1 by Olaf van der Spek
Add do_sha1()
42
    SHA1_CTX() :
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.
43
    	count(0)
44
    {
45
      memset(state, 0, 5);
46
      memset(buffer, 0, SHA1_BLOCK_LENGTH);
47
    }
2409.3.1 by Olaf van der Spek
Add do_sha1()
48
};
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
49
2409.3.1 by Olaf van der Spek
Add do_sha1()
50
DRIZZLED_API void SHA1Init(SHA1_CTX*);
51
DRIZZLED_API void SHA1Pad(SHA1_CTX*);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
52
DRIZZLED_API void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
2409.3.1 by Olaf van der Spek
Add do_sha1()
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]);
1337.4.2 by Eric Day
Added MYSQL_PASSWORD() UDF.
57
58
/** @} */
59
60
} /* namespace drizzled */