plibsys 0.0.5
pcryptohash.h
Go to the documentation of this file.
1/*
2 * The MIT License
3 *
4 * Copyright (C) 2010-2016 Alexander Saprykin <saprykin.spb@gmail.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * 'Software'), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
72#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
73# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
74#endif
75
76#ifndef PLIBSYS_HEADER_PCRYPTOHASH_H
77#define PLIBSYS_HEADER_PCRYPTOHASH_H
78
79#include <pmacros.h>
80#include <ptypes.h>
81
83
85typedef struct PCryptoHash_ PCryptoHash;
86
101
110
121 const puchar *data,
122 psize len);
123
134
146
158 puchar *buf,
159 psize *len);
160
170
178
185
187
188#endif /* PLIBSYS_HEADER_PCRYPTOHASH_H */
struct PCryptoHash_ PCryptoHash
Opaque data structure for handling a cryptographic hash context.
Definition pcryptohash.h:85
P_LIB_API void p_crypto_hash_reset(PCryptoHash *hash)
Resets a hash state.
P_LIB_API pchar * p_crypto_hash_get_string(PCryptoHash *hash)
Gets a hash in a hexidemical representation.
P_LIB_API PCryptoHashType p_crypto_hash_get_type(const PCryptoHash *hash)
Gets a hash function type.
P_LIB_API pssize p_crypto_hash_get_length(const PCryptoHash *hash)
Gets a hash digest length depending on its type.
P_LIB_API PCryptoHash * p_crypto_hash_new(PCryptoHashType type)
Initializes a new PCryptoHash context.
enum PCryptoHashType_ PCryptoHashType
Cryptographic hash function types for PCryptoHash.
P_LIB_API void p_crypto_hash_update(PCryptoHash *hash, const puchar *data, psize len)
Adds a new chunk of data for hashing.
P_LIB_API void p_crypto_hash_free(PCryptoHash *hash)
Frees a previously initialized hash context.
P_LIB_API void p_crypto_hash_get_digest(PCryptoHash *hash, puchar *buf, psize *len)
Gets a hash in a raw representation.
PCryptoHashType_
Cryptographic hash function types for PCryptoHash.
Definition pcryptohash.h:88
@ P_CRYPTO_HASH_TYPE_MD5
MD5 hash function.
Definition pcryptohash.h:89
@ P_CRYPTO_HASH_TYPE_SHA3_224
SHA-2/224 hash function.
Definition pcryptohash.h:95
@ P_CRYPTO_HASH_TYPE_SHA2_256
SHA-2/256 hash function.
Definition pcryptohash.h:92
@ P_CRYPTO_HASH_TYPE_SHA1
SHA-1 hash function.
Definition pcryptohash.h:90
@ P_CRYPTO_HASH_TYPE_SHA3_256
SHA-2/256 hash function.
Definition pcryptohash.h:96
@ P_CRYPTO_HASH_TYPE_SHA2_384
SHA-2/384 hash function.
Definition pcryptohash.h:93
@ P_CRYPTO_HASH_TYPE_SHA3_512
SHA-3/512 hash function.
Definition pcryptohash.h:98
@ P_CRYPTO_HASH_TYPE_SHA2_224
SHA-2/224 hash function.
Definition pcryptohash.h:91
@ P_CRYPTO_HASH_TYPE_SHA3_384
SHA-2/384 hash function.
Definition pcryptohash.h:97
@ P_CRYPTO_HASH_TYPE_GOST
GOST (R 34.11-94) hash function.
Definition pcryptohash.h:99
@ P_CRYPTO_HASH_TYPE_SHA2_512
SHA-2/512 hash function.
Definition pcryptohash.h:94
Miscellaneous macros.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition pmacros.h:298
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
Definition pmacros.h:299
#define P_LIB_API
Exports a symbol from a shared library.
Definition pmacros.h:138
Types definitions.
signed int pssize
Type for a platform independent signed size_t.
Definition ptypes.h:223
char pchar
Type for a char.
Definition ptypes.h:116
unsigned int psize
Type for a platform independent size_t.
Definition ptypes.h:224
unsigned char puchar
Type for an unsigned char.
Definition ptypes.h:125