drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
sha1.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 nobody (this is public domain)
3 */
4
9
10#pragma once
11
12#include <stdint.h>
13#include <sys/types.h>
14#include <string.h>
15
16#include <drizzled/util/data_ref.h>
17#include <drizzled/visibility.h>
18
19namespace drizzled {
20
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
35class SHA1_CTX
36{
37public:
38 uint32_t state[5];
39 uint64_t count;
40 uint8_t buffer[SHA1_BLOCK_LENGTH];
41
42 SHA1_CTX() :
43 count(0)
44 {
45 memset(state, 0, sizeof(state));
46 memset(buffer, 0, SHA1_BLOCK_LENGTH);
47 }
48};
49
50DRIZZLED_API void SHA1Init(SHA1_CTX*);
51DRIZZLED_API void SHA1Pad(SHA1_CTX*);
52DRIZZLED_API void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
53DRIZZLED_API void SHA1Update(SHA1_CTX*, const uint8_t*, size_t);
54DRIZZLED_API void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX*);
55
56void do_sha1(data_ref, uint8_t[SHA1_DIGEST_LENGTH]);
57
59
60} /* namespace drizzled */
TODO: Rename this file - func.h is stupid.
Visibility Control Macros.
#define DRIZZLED_API
Definition visibility.h:38