Main Page   Compound List   File List   Compound Members   File Members  

sha256.c File Reference

#include "stdio.h"
#include "sha256.h"

Include dependency graph for sha256.c:

Include dependency graph

Defines

#define Ch(x, y, z)   ((x & y) ^ (~x & z))
#define Maj(x, y, z)   ((x & y) ^ (x & z) ^ (y & z))
#define e0(x)   (RORuns32(x,2) ^ RORuns32(x,13) ^ RORuns32(x,22))
#define e1(x)   (RORuns32(x,6) ^ RORuns32(x,11) ^ RORuns32(x,25))
#define s0(x)   (RORuns32(x,7) ^ RORuns32(x,18) ^ (x >> 3))
#define s1(x)   (RORuns32(x,17) ^ RORuns32(x,19) ^ (x >> 10))
#define H0   0x6a09e667
#define H1   0xbb67ae85
#define H2   0x3c6ef372
#define H3   0xa54ff53a
#define H4   0x510e527f
#define H5   0x9b05688c
#define H6   0x1f83d9ab
#define H7   0x5be0cd19
#define LOAD_OP(I)
#define BLEND_OP(I)

Functions

void sha256_xform (uns32 *state, const uns8 *input)

Define Documentation

#define BLEND_OP( I )
 

Value:

  W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];

#define Ch( x, y, z )   ((x & y) ^ (~x & z))
 

A contribution to the open-source movement. Jean-Luc Cooke <jlcooke@certainkey.com> CertainKey Inc. Ottawa Ontario Canada

Created: July 20th, 2001

The following program code is released under the GPL license http://www.gnu.org/copyleft/gpl.html

#define H0   0x6a09e667
 

#define H1   0xbb67ae85
 

#define H2   0x3c6ef372
 

#define H3   0xa54ff53a
 

#define H4   0x510e527f
 

#define H5   0x9b05688c
 

#define H6   0x1f83d9ab
 

#define H7   0x5be0cd19
 

#define LOAD_OP( I )
 

Value:

 {\
  t1  = input[(4*I)  ] & 0xff; t1<<=8;\
  t1 |= input[(4*I)+1] & 0xff; t1<<=8;\
  t1 |= input[(4*I)+2] & 0xff; t1<<=8;\
  t1 |= input[(4*I)+3] & 0xff;\
  W[I] = t1;\
 }

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

#define e0( x )   (RORuns32(x,2) ^ RORuns32(x,13) ^ RORuns32(x,22))
 

#define e1( x )   (RORuns32(x,6) ^ RORuns32(x,11) ^ RORuns32(x,25))
 

#define s0( x )   (RORuns32(x,7) ^ RORuns32(x,18) ^ (x >> 3))
 

#define s1( x )   (RORuns32(x,17) ^ RORuns32(x,19) ^ (x >> 10))
 


Function Documentation

void sha256_xform ( uns32 * state,
const uns8 * input )
 



OpenSource