SDTS_AL
Main Page
Related Pages
Classes
Files
File List
File Members
port
cpl_sha256.h
1
/* $Id: cpl_sha256.h 34921 2016-08-04 22:26:31Z rouault $ */
2
3
/* The MIT License
4
5
Copyright (C) 2011 Zilong Tan (tzlloch@gmail.com)
6
Copyright (C) 2015 Even Rouault <even.rouault at spatialys.com>
7
8
Permission is hereby granted, free of charge, to any person obtaining
9
a copy of this software and associated documentation files (the
10
"Software"), to deal in the Software without restriction, including
11
without limitation the rights to use, copy, modify, merge, publish,
12
distribute, sublicense, and/or sell copies of the Software, and to
13
permit persons to whom the Software is furnished to do so, subject to
14
the following conditions:
15
16
The above copyright notice and this permission notice shall be
17
included in all copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
SOFTWARE.
27
*/
28
29
#ifndef CPL_SHA256_INCLUDED_H
30
#define CPL_SHA256_INCLUDED_H
31
32
#ifndef DOXYGEN_SKIP
33
34
#include "
cpl_port.h
"
35
36
#define CPL_SHA256_HASH_SIZE 32
/* 256 bit */
37
#define CPL_SHA256_HASH_WORDS 8
38
39
#ifndef GUInt64
40
#define GUInt64 GUIntBig
41
#endif
42
43
CPL_C_START
44
45
struct
_CPL_SHA256Context
{
46
GUInt64
totalLength;
47
GUInt32
hash[CPL_SHA256_HASH_WORDS];
48
GUInt32
bufferLength;
49
union
{
50
GUInt32
words[16];
51
GByte
bytes[64];
52
} buffer;
53
};
54
typedef
struct
_CPL_SHA256Context
CPL_SHA256Context
;
55
56
void
CPL_DLL CPL_SHA256Init(
CPL_SHA256Context
* sc);
57
58
void
CPL_DLL CPL_SHA256Update(
CPL_SHA256Context
* sc,
const
void
*data,
size_t
len);
59
60
void
CPL_DLL CPL_SHA256Final(
CPL_SHA256Context
* sc,
GByte
hash[CPL_SHA256_HASH_SIZE]);
61
62
void
CPL_DLL CPL_SHA256(
const
void
*data,
size_t
len,
GByte
hash[CPL_SHA256_HASH_SIZE]);
63
64
void
CPL_DLL CPL_HMAC_SHA256(
const
void
*pKey,
size_t
nKeyLen,
65
const
void
*pabyMessage,
size_t
nMessageLen,
66
GByte
abyDigest[CPL_SHA256_HASH_SIZE]);
67
68
CPL_C_END
69
70
#endif
/* #ifndef DOXYGEN_SKIP */
71
72
#endif
/* CPL_SHA256_INCLUDED_H */
cpl_port.h
GUInt32
unsigned int GUInt32
Definition:
cpl_port.h:199
GByte
unsigned char GByte
Definition:
cpl_port.h:207
_CPL_SHA256Context
Definition:
cpl_sha256.h:45
GUInt64
GUIntBig GUInt64
Definition:
cpl_port.h:271
Generated by
1.8.5