2
0

md5.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*-------------------------------------------------------------------------
  2. *
  3. * md5.h
  4. * Constants and common utilities related to MD5.
  5. *
  6. * These definitions are needed by both frontend and backend code to work
  7. * with MD5-encrypted passwords.
  8. *
  9. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  10. * Portions Copyright (c) 1994, Regents of the University of California
  11. *
  12. * src/include/common/md5.h
  13. *
  14. *-------------------------------------------------------------------------
  15. */
  16. #ifndef PG_MD5_H
  17. #define PG_MD5_H
  18. /* Size of result generated by MD5 computation */
  19. #define MD5_DIGEST_LENGTH 16
  20. /* Block size for MD5 */
  21. #define MD5_BLOCK_SIZE 64
  22. /* password-related data */
  23. #define MD5_PASSWD_CHARSET "0123456789abcdef"
  24. #define MD5_PASSWD_LEN 35
  25. /* Utilities common to all the MD5 implementations, as of md5_common.c */
  26. extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum,
  27. const char **errstr);
  28. extern bool pg_md5_binary(const void *buff, size_t len, void *outbuf,
  29. const char **errstr);
  30. extern bool pg_md5_encrypt(const char *passwd, const char *salt,
  31. size_t salt_len, char *buf,
  32. const char **errstr);
  33. #endif /* PG_MD5_H */