PostgreSQL Source Code  git master
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 435 of file md5.c.

436 {
437  md5_pad(ctx);
438  md5_result(dest, ctx);
439 }
static void md5_result(uint8 *digest, pg_md5_ctx *ctx)
Definition: md5.c:351
static void md5_pad(pg_md5_ctx *ctx)
Definition: md5.c:313

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 385 of file md5.c.

386 {
387  ctx->md5_n = 0;
388  ctx->md5_i = 0;
389  ctx->md5_sta = MD5_A0;
390  ctx->md5_stb = MD5_B0;
391  ctx->md5_stc = MD5_C0;
392  ctx->md5_std = MD5_D0;
393  memset(ctx->md5_buf, 0, sizeof(ctx->md5_buf));
394 }
#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 403 of file md5.c.

404 {
405  unsigned int gap,
406  i;
407 
408  ctx->md5_n += len * 8; /* byte to bit */
409  gap = MD5_BUFLEN - ctx->md5_i;
410 
411  if (len >= gap)
412  {
413  memmove(ctx->md5_buf + ctx->md5_i, data, gap);
414  md5_calc(ctx->md5_buf, ctx);
415 
416  for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN)
417  md5_calc(data + i, ctx);
418 
419  ctx->md5_i = len - i;
420  memmove(ctx->md5_buf, data + i, ctx->md5_i);
421  }
422  else
423  {
424  memmove(ctx->md5_buf + ctx->md5_i, data, len);
425  ctx->md5_i += len;
426  }
427 }
int i
Definition: isn.c:73
static void md5_calc(const uint8 *b64, pg_md5_ctx *ctx)
Definition: md5.c:158
#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().