codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * cryptohash.h4 * Generic headers for cryptographic hash functions.5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * IDENTIFICATION10 * src/include/common/cryptohash.h11 *12 *-------------------------------------------------------------------------13 */14 15#ifndef PG_CRYPTOHASH_H16#define PG_CRYPTOHASH_H17 18/* Context Structures for each hash function */19typedef enum20{21 PG_MD5 = 0,22 PG_SHA1,23 PG_SHA224,24 PG_SHA256,25 PG_SHA384,26 PG_SHA51227} pg_cryptohash_type;28 29/* opaque context, private to each cryptohash implementation */30typedef 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 */40 