PostgreSQL Source Code: src/include/common/cryptohash.h Source File

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-2025, 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,
22 PG_SHA1,
23 PG_SHA224,
24 PG_SHA256,
25 PG_SHA384,
26 PG_SHA512,
27} pg_cryptohash_type;
28
29/* opaque context, private to each cryptohash implementation */
30 typedef struct pg_cryptohash_ctx pg_cryptohash_ctx;
31
32extern pg_cryptohash_ctx *pg_cryptohash_create(pg_cryptohash_type type);
33extern int pg_cryptohash_init(pg_cryptohash_ctx *ctx);
34extern int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len);
35extern int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len);
36extern void pg_cryptohash_free(pg_cryptohash_ctx *ctx);
37extern const char *pg_cryptohash_error(pg_cryptohash_ctx *ctx);
38
39#endif /* PG_CRYPTOHASH_H */
uint8_t uint8
Definition: c.h:536
const char * pg_cryptohash_error(pg_cryptohash_ctx *ctx)
Definition: cryptohash.c:254
int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
Definition: cryptohash.c:136
pg_cryptohash_ctx * pg_cryptohash_create(pg_cryptohash_type type)
Definition: cryptohash.c:74
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
int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
Definition: cryptohash.c:172
const void size_t len
const void * data
const char * type

AltStyle によって変換されたページ (->オリジナル) /