Process Hacker
sha.c File Reference
#include <phbase.h>
#include <sha.h>

Go to the source code of this file.

Macros

#define rol(value, bits)   (_rotl((value), (bits)))
 
#define DWORD2BE(x)   (((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000);
 
#define blk0(i)   (Block[i] = (rol(Block[i],24)&0xFF00FF00)|(rol(Block[i],8)&0x00FF00FF))
 
#define blk1(i)   (Block[i&15] = rol(Block[(i+13)&15]^Block[(i+8)&15]^Block[(i+2)&15]^Block[i&15],1))
 
#define f1(x, y, z)   (z^(x&(y^z)))
 
#define f2(x, y, z)   (x^y^z)
 
#define f3(x, y, z)   ((x&y)|(z&(x|y)))
 
#define f4(x, y, z)   (x^y^z)
 
#define R0(v, w, x, y, z, i)   z+=f1(w,x,y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R1(v, w, x, y, z, i)   z+=f1(w,x,y)+blk1(i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R2(v, w, x, y, z, i)   z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
 
#define R3(v, w, x, y, z, i)   z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
 
#define R4(v, w, x, y, z, i)   z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
 

Functions

VOID A_SHAInit (_Out_ A_SHA_CTX *Context)
 
VOID A_SHAUpdate (_Inout_ A_SHA_CTX *Context, _In_reads_bytes_(Length) UCHAR *Input, _In_ ULONG Length)
 
VOID A_SHAFinal (_Inout_ A_SHA_CTX *Context, _Out_writes_bytes_(20) UCHAR *Hash)
 

Macro Definition Documentation

#define blk0 (   i)    (Block[i] = (rol(Block[i],24)&0xFF00FF00)|(rol(Block[i],8)&0x00FF00FF))

Definition at line 30 of file sha.c.

#define blk1 (   i)    (Block[i&15] = rol(Block[(i+13)&15]^Block[(i+8)&15]^Block[(i+2)&15]^Block[i&15],1))

Definition at line 31 of file sha.c.

#define DWORD2BE (   x)    (((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000);

Definition at line 29 of file sha.c.

#define f1 (   x,
  y,
 
)    (z^(x&(y^z)))

Definition at line 32 of file sha.c.

#define f2 (   x,
  y,
 
)    (x^y^z)

Definition at line 33 of file sha.c.

#define f3 (   x,
  y,
 
)    ((x&y)|(z&(x|y)))

Definition at line 34 of file sha.c.

#define f4 (   x,
  y,
 
)    (x^y^z)

Definition at line 35 of file sha.c.

#define R0 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f1(w,x,y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 37 of file sha.c.

#define R1 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f1(w,x,y)+blk1(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 38 of file sha.c.

#define R2 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);

Definition at line 39 of file sha.c.

#define R3 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);

Definition at line 40 of file sha.c.

#define R4 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);

Definition at line 41 of file sha.c.

#define rol (   value,
  bits 
)    (_rotl((value), (bits)))

Definition at line 28 of file sha.c.

Function Documentation

VOID A_SHAFinal ( _Inout_ A_SHA_CTX Context,
_Out_writes_bytes_(20) UCHAR *  Hash 
)

Definition at line 139 of file sha.c.

VOID A_SHAInit ( _Out_ A_SHA_CTX Context)

Definition at line 91 of file sha.c.

VOID A_SHAUpdate ( _Inout_ A_SHA_CTX Context,
_In_reads_bytes_(Length) UCHAR *  Input,
_In_ ULONG  Length 
)

Definition at line 105 of file sha.c.