cpl_sha256.h

00001 /* $Id: cpl_sha256.h 31777 2015-11-26 14:14:41Z rouault $ */
00002 
00003 /* The MIT License
00004 
00005    Copyright (C) 2011 Zilong Tan (tzlloch@gmail.com)
00006    Copyright (C) 2015 Even Rouault <even.rouault at spatialys.com>
00007 
00008    Permission is hereby granted, free of charge, to any person obtaining
00009    a copy of this software and associated documentation files (the
00010    "Software"), to deal in the Software without restriction, including
00011    without limitation the rights to use, copy, modify, merge, publish,
00012    distribute, sublicense, and/or sell copies of the Software, and to
00013    permit persons to whom the Software is furnished to do so, subject to
00014    the following conditions:
00015 
00016    The above copyright notice and this permission notice shall be
00017    included in all copies or substantial portions of the Software.
00018 
00019    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00022    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00023    BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00024    ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00025    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00026    SOFTWARE.
00027 */
00028 
00029 #ifndef CPL_SHA256_INCLUDED_H
00030 #define CPL_SHA256_INCLUDED_H
00031 
00032 #include "cpl_port.h"
00033 
00034 #define CPL_SHA256_HASH_SIZE 32     /* 256 bit */
00035 #define CPL_SHA256_HASH_WORDS 8
00036 
00037 #ifndef GUInt64
00038 #define GUInt64 GUIntBig
00039 #endif
00040 
00041 CPL_C_START
00042 
00043 struct _CPL_SHA256Context {
00044         GUInt64 totalLength;
00045         GUInt32 hash[CPL_SHA256_HASH_WORDS];
00046         GUInt32 bufferLength;
00047         union {
00048                 GUInt32 words[16];
00049                 GByte bytes[64];
00050         } buffer;
00051 };
00052 typedef struct _CPL_SHA256Context CPL_SHA256Context;
00053 
00054 void CPL_DLL CPL_SHA256Init(CPL_SHA256Context * sc);
00055 
00056 void CPL_DLL CPL_SHA256Update(CPL_SHA256Context * sc, const void *data, size_t len);
00057 
00058 void CPL_DLL CPL_SHA256Final(CPL_SHA256Context * sc, GByte hash[CPL_SHA256_HASH_SIZE]);
00059 
00060 void CPL_DLL CPL_SHA256(const void *data, size_t len, GByte hash[CPL_SHA256_HASH_SIZE]);
00061 
00062 void CPL_DLL CPL_HMAC_SHA256(const void *pKey, size_t nKeyLen,
00063                              const void *pabyMessage, size_t nMessageLen,
00064                              GByte abyDigest[CPL_SHA256_HASH_SIZE]);
00065 
00066 CPL_C_END
00067 
00068 #endif  /* CPL_SHA256_INCLUDED_H */

Generated for GDAL by doxygen 1.6.1.