GDAL
cpl_sha256.h
00001 /* $Id: cpl_sha256.h 34921 2016-08-04 22:26:31Z 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 #ifndef DOXYGEN_SKIP
00033 
00034 #include "cpl_port.h"
00035 
00036 #define CPL_SHA256_HASH_SIZE 32     /* 256 bit */
00037 #define CPL_SHA256_HASH_WORDS 8
00038 
00039 #ifndef GUInt64
00040 #define GUInt64 GUIntBig
00041 #endif
00042 
00043 CPL_C_START
00044 
00045 struct _CPL_SHA256Context {
00046         GUInt64 totalLength;
00047         GUInt32 hash[CPL_SHA256_HASH_WORDS];
00048         GUInt32 bufferLength;
00049         union {
00050                 GUInt32 words[16];
00051                 GByte bytes[64];
00052         } buffer;
00053 };
00054 typedef struct _CPL_SHA256Context CPL_SHA256Context;
00055 
00056 void CPL_DLL CPL_SHA256Init(CPL_SHA256Context * sc);
00057 
00058 void CPL_DLL CPL_SHA256Update(CPL_SHA256Context * sc, const void *data, size_t len);
00059 
00060 void CPL_DLL CPL_SHA256Final(CPL_SHA256Context * sc, GByte hash[CPL_SHA256_HASH_SIZE]);
00061 
00062 void CPL_DLL CPL_SHA256(const void *data, size_t len, GByte hash[CPL_SHA256_HASH_SIZE]);
00063 
00064 void CPL_DLL CPL_HMAC_SHA256(const void *pKey, size_t nKeyLen,
00065                              const void *pabyMessage, size_t nMessageLen,
00066                              GByte abyDigest[CPL_SHA256_HASH_SIZE]);
00067 
00068 CPL_C_END
00069 
00070 #endif /* #ifndef DOXYGEN_SKIP */
00071 
00072 #endif  /* CPL_SHA256_INCLUDED_H */

Generated for GDAL by doxygen 1.7.6.1.