PostgreSQL Source Code  git master
cryptohash.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * cryptohash.h
4  * Generic headers for cryptographic hash functions.
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * IDENTIFICATION
10  * src/include/common/cryptohash.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #ifndef PG_CRYPTOHASH_H
16 #define PG_CRYPTOHASH_H
17 
18 /* Context Structures for each hash function */
19 typedef enum
20 {
21  PG_MD5 = 0,
28 
29 /* opaque context, private to each cryptohash implementation */
31 
33 extern int pg_cryptohash_init(pg_cryptohash_ctx *ctx);
34 extern int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len);
35 extern int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len);
36 extern void pg_cryptohash_free(pg_cryptohash_ctx *ctx);
37 extern const char *pg_cryptohash_error(pg_cryptohash_ctx *ctx);
38 
39 #endif /* PG_CRYPTOHASH_H */
unsigned char uint8
Definition: c.h:504
int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
Definition: cryptohash.c:136
pg_cryptohash_type
Definition: cryptohash.h:20
@ PG_SHA512
Definition: cryptohash.h:26
@ PG_SHA224
Definition: cryptohash.h:23
@ PG_SHA384
Definition: cryptohash.h:25
@ PG_SHA1
Definition: cryptohash.h:22
@ PG_SHA256
Definition: cryptohash.h:24
@ PG_MD5
Definition: cryptohash.h:21
int pg_cryptohash_init(pg_cryptohash_ctx *ctx)
Definition: cryptohash.c:100
void pg_cryptohash_free(pg_cryptohash_ctx *ctx)
Definition: cryptohash.c:238
pg_cryptohash_ctx * pg_cryptohash_create(pg_cryptohash_type type)
Definition: cryptohash.c:74
int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
Definition: cryptohash.c:172
const char * pg_cryptohash_error(pg_cryptohash_ctx *ctx)
Definition: cryptohash.c:254
const void size_t len
const void * data
const char * type