GDAL
cpl_sha1.h
1/******************************************************************************
2 *
3 * Project: CPL - Common Portability Library
4 * Purpose: Implement SHA1
5 * Author: Even Rouault, even.rouault at spatialys.com
6 *
7 * SHA1 computation coming from Public Domain code at:
8 * https://github.com/B-Con/crypto-algorithms/blob/master/sha1.c
9 * by Brad Conte (brad AT bradconte.com)
10 *
11 ******************************************************************************
12 * Copyright (c) 2017, Even Rouault <even.rouault at spatialys.com>
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the "Software"),
16 * to deal in the Software without restriction, including without limitation
17 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 * and/or sell copies of the Software, and to permit persons to whom the
19 * Software is furnished to do so, subject to the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included
22 * in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 ****************************************************************************/
32
33#ifndef CPL_SHA1_INCLUDED_H
34#define CPL_SHA1_INCLUDED_H
35
36#ifndef DOXYGEN_SKIP
37
38#include "cpl_port.h"
39
40#define CPL_SHA1_HASH_SIZE 20 // SHA1 outputs a 20 byte digest
41
43
44/* Not CPL_DLL exported */
45void CPL_HMAC_SHA1(const void *pKey, size_t nKeyLen, const void *pabyMessage,
46 size_t nMessageLen, GByte abyDigest[CPL_SHA1_HASH_SIZE]);
47
49
50#endif /* #ifndef DOXYGEN_SKIP */
51
52#endif /* CPL_SHA1_INCLUDED_H */
Core portability definitions for CPL.
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:299
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:295
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:185