Drizzled Public API Documentation

sha1.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 nobody (this is public domain)
00003  */
00004 
00010 #pragma once
00011 
00012 #include <stdint.h>
00013 #include <sys/types.h>
00014 #include <string.h>
00015 
00016 #include <drizzled/visibility.h>
00017 
00018 namespace drizzled
00019 {
00020 
00031 #define SHA1_BLOCK_LENGTH   64
00032 #define SHA1_DIGEST_LENGTH    20
00033 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
00034 
00035 typedef class sha1_ctx{
00036 public:
00037     uint32_t state[5];
00038     uint64_t count;
00039     uint8_t buffer[SHA1_BLOCK_LENGTH];
00040 
00041     sha1_ctx():
00042       count(0)
00043     {
00044       memset(state, 0, 5);
00045       memset(buffer, 0, SHA1_BLOCK_LENGTH);
00046     }
00047 } SHA1_CTX;
00048 
00049 DRIZZLED_API void SHA1Init(SHA1_CTX *);
00050 DRIZZLED_API void SHA1Pad(SHA1_CTX *);
00051 DRIZZLED_API void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
00052 DRIZZLED_API void SHA1Update(SHA1_CTX *, const uint8_t *, size_t);
00053 DRIZZLED_API void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *);
00054 
00057 } /* namespace drizzled */
00058