PostgreSQL Source Code  git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
md5_int.h File Reference
#include "common/md5.h"
Include dependency graph for md5_int.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pg_md5_ctx
 

Macros

#define MD5_BUFLEN   64
 
#define md5_sta   md5_st.md5_state32[0]
 
#define md5_stb   md5_st.md5_state32[1]
 
#define md5_stc   md5_st.md5_state32[2]
 
#define md5_std   md5_st.md5_state32[3]
 
#define md5_st8   md5_st.md5_state8
 
#define md5_n   md5_count.md5_count64
 
#define md5_n8   md5_count.md5_count8
 

Functions

void pg_md5_init (pg_md5_ctx *ctx)
 
void pg_md5_update (pg_md5_ctx *ctx, const uint8 *data, size_t len)
 
void pg_md5_final (pg_md5_ctx *ctx, uint8 *dest)
 

Macro Definition Documentation

◆ MD5_BUFLEN

#define MD5_BUFLEN   64

Definition at line 51 of file md5_int.h.

◆ md5_n

#define md5_n   md5_count.md5_count64

Definition at line 73 of file md5_int.h.

◆ md5_n8

#define md5_n8   md5_count.md5_count8

Definition at line 74 of file md5_int.h.

◆ md5_st8

#define md5_st8   md5_st.md5_state8

Definition at line 66 of file md5_int.h.

◆ md5_sta

#define md5_sta   md5_st.md5_state32[0]

Definition at line 62 of file md5_int.h.

◆ md5_stb

#define md5_stb   md5_st.md5_state32[1]

Definition at line 63 of file md5_int.h.

◆ md5_stc

#define md5_stc   md5_st.md5_state32[2]

Definition at line 64 of file md5_int.h.

◆ md5_std

#define md5_std   md5_st.md5_state32[3]

Definition at line 65 of file md5_int.h.

Function Documentation

◆ pg_md5_final()

void pg_md5_final ( pg_md5_ctx ctx,
uint8 dest 
)

Definition at line 432 of file md5.c.

433 {
434  md5_pad(ctx);
435  md5_result(dest, ctx);
436 }
static void md5_result(uint8 *digest, pg_md5_ctx *ctx)
Definition: md5.c:348
static void md5_pad(pg_md5_ctx *ctx)
Definition: md5.c:310

References generate_unaccent_rules::dest, md5_pad(), and md5_result().

Referenced by pg_cryptohash_final().

◆ pg_md5_init()

void pg_md5_init ( pg_md5_ctx ctx)

Definition at line 382 of file md5.c.

383 {
384  ctx->md5_n = 0;
385  ctx->md5_i = 0;
386  ctx->md5_sta = MD5_A0;
387  ctx->md5_stb = MD5_B0;
388  ctx->md5_stc = MD5_C0;
389  ctx->md5_std = MD5_D0;
390  memset(ctx->md5_buf, 0, sizeof(ctx->md5_buf));
391 }
#define MD5_B0
Definition: md5.c:114
#define MD5_C0
Definition: md5.c:115
#define MD5_D0
Definition: md5.c:116
#define MD5_A0
Definition: md5.c:113
unsigned int md5_i
Definition: md5_int.h:76
uint8 md5_buf[MD5_BUFLEN]
Definition: md5_int.h:77

References MD5_A0, MD5_B0, pg_md5_ctx::md5_buf, MD5_C0, MD5_D0, and pg_md5_ctx::md5_i.

Referenced by pg_cryptohash_init().

◆ pg_md5_update()

void pg_md5_update ( pg_md5_ctx ctx,
const uint8 data,
size_t  len 
)

Definition at line 400 of file md5.c.

401 {
402  unsigned int gap,
403  i;
404 
405  ctx->md5_n += len * 8; /* byte to bit */
406  gap = MD5_BUFLEN - ctx->md5_i;
407 
408  if (len >= gap)
409  {
410  memmove(ctx->md5_buf + ctx->md5_i, data, gap);
411  md5_calc(ctx->md5_buf, ctx);
412 
413  for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN)
414  md5_calc(data + i, ctx);
415 
416  ctx->md5_i = len - i;
417  memmove(ctx->md5_buf, data + i, ctx->md5_i);
418  }
419  else
420  {
421  memmove(ctx->md5_buf + ctx->md5_i, data, len);
422  ctx->md5_i += len;
423  }
424 }
int i
Definition: isn.c:72
static void md5_calc(const uint8 *b64, pg_md5_ctx *ctx)
Definition: md5.c:154
#define MD5_BUFLEN
Definition: md5_int.h:51
const void size_t len
const void * data

References data, i, len, pg_md5_ctx::md5_buf, MD5_BUFLEN, md5_calc(), and pg_md5_ctx::md5_i.

Referenced by pg_cryptohash_update().