Macros | Functions | Variables
sha1.c File Reference
#include "sha1.h"
#include <string.h>
Include dependency graph for sha1.c:

Go to the source code of this file.

Macros

#define BCOUNT   (ctxt->c.b64[0] / 8)
 
#define COUNT   (ctxt->count)
 
#define F0(b, c, d)   (((b) & (c)) | ((~(b)) & (d)))
 
#define F1(b, c, d)   (((b) ^ (c)) ^ (d))
 
#define F2(b, c, d)   (((b) & (c)) | ((b) & (d)) | ((c) & (d)))
 
#define F3(b, c, d)   (((b) ^ (c)) ^ (d))
 
#define H(n)   (ctxt->h.b32[(n)])
 
#define K(t)   _K[(t) / 20]
 
#define PUTBYTE(x)
 
#define PUTPAD(x)
 
#define S(n, x)   (((x) << (n)) | ((x) >> (32 - (n))))
 
#define W(n)   (ctxt->m.b32[(n)])
 

Functions

void sha1_init (struct sha1_ctxt *ctxt)
 
void sha1_loop (struct sha1_ctxt *ctxt, const uint8_t *input0, size_t len)
 
void sha1_pad (struct sha1_ctxt *ctxt)
 
void sha1_result (struct sha1_ctxt *ctxt, uint8_t *digest0)
 
static void sha1_step (struct sha1_ctxt *)
 

Variables

static uint32_t _K [] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6}
 

Macro Definition Documentation

◆ BCOUNT

#define BCOUNT   (ctxt->c.b64[0] / 8)

Definition at line 54 of file sha1.c.

◆ COUNT

#define COUNT   (ctxt->count)

Definition at line 53 of file sha1.c.

◆ F0

#define F0 (   b,
  c,
  d 
)    (((b) & (c)) | ((~(b)) & (d)))

Definition at line 45 of file sha1.c.

◆ F1

#define F1 (   b,
  c,
  d 
)    (((b) ^ (c)) ^ (d))

Definition at line 46 of file sha1.c.

◆ F2

#define F2 (   b,
  c,
  d 
)    (((b) & (c)) | ((b) & (d)) | ((c) & (d)))

Definition at line 47 of file sha1.c.

◆ F3

#define F3 (   b,
  c,
  d 
)    (((b) ^ (c)) ^ (d))

Definition at line 48 of file sha1.c.

◆ H

#define H (   n)    (ctxt->h.b32[(n)])

Definition at line 52 of file sha1.c.

◆ K

#define K (   t)    _K[(t) / 20]

Definition at line 43 of file sha1.c.

◆ PUTBYTE

#define PUTBYTE (   x)
Value:
do { \
ctxt->m.b8[(COUNT % 64)] = (x); \
COUNT++; \
COUNT %= 64; \
ctxt->c.b64[0] += 8; \
if (COUNT % 64 == 0) \
sha1_step(ctxt); \
} while (0)

Definition at line 57 of file sha1.c.

◆ PUTPAD

#define PUTPAD (   x)
Value:
do { \
ctxt->m.b8[(COUNT % 64)] = (x); \
COUNT++; \
COUNT %= 64; \
if (COUNT % 64 == 0) \
sha1_step(ctxt); \
} while (0)

Definition at line 67 of file sha1.c.

◆ S

#define S (   n,
  x 
)    (((x) << (n)) | ((x) >> (32 - (n))))

Definition at line 50 of file sha1.c.

◆ W

#define W (   n)    (ctxt->m.b32[(n)])

Definition at line 55 of file sha1.c.

Function Documentation

◆ sha1_init()

void sha1_init ( struct sha1_ctxt ctxt)

Definition at line 224 of file sha1.c.

◆ sha1_loop()

void sha1_loop ( struct sha1_ctxt ctxt,
const uint8_t *  input0,
size_t  len 
)

Definition at line 278 of file sha1.c.

◆ sha1_pad()

void sha1_pad ( struct sha1_ctxt ctxt)

Definition at line 235 of file sha1.c.

◆ sha1_result()

void sha1_result ( struct sha1_ctxt ctxt,
uint8_t *  digest0 
)

Definition at line 306 of file sha1.c.

◆ sha1_step()

static void sha1_step ( struct sha1_ctxt ctxt)
static

Definition at line 79 of file sha1.c.

Variable Documentation

◆ _K

uint32_t _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6}
static

Definition at line 41 of file sha1.c.

x
GLint GLenum GLint x
Definition: glcorearb.h:2834
COUNT
#define COUNT
Definition: sha1.c:53


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:04