libxcks  0.1.0.1
sha1.cpp File Reference

Compute sha1 hash. More...

#include <cstring>
#include "sha1.hpp"
Include dependency graph for sha1.cpp:

Go to the source code of this file.

Macros

#define X(a)
 Helper value for SHA1's computing. More...
 
#define K1   0x5A827999L
 Helper value for SHA1's computing. More...
 
#define K2   0x6ED9EBA1L
 Helper value for SHA1's computing. More...
 
#define K3   0x8F1BBCDCL
 Helper value for SHA1's computing. More...
 
#define K4   0xCA62C1D6L
 Helper value for SHA1's computing. More...
 
#define F1(x, y, z)   ( z ^ ( x & ( y ^ z ) ) )
 Helper value for SHA1's computing. More...
 
#define F2(x, y, z)   ( x ^ y ^ z )
 Helper value for SHA1's computing. More...
 
#define F3(x, y, z)   ( ( x & y ) | ( z & ( x | y ) ) )
 Helper value for SHA1's computing. More...
 
#define F4(x, y, z)   ( x ^ y ^ z )
 Helper value for SHA1's computing. More...
 
#define M(i)
 Helper value for SHA1's computing. More...
 
#define R(a, b, c, d, e, f, k, m)
 Helper value for SHA1's computing. More...
 

Detailed Description

Compute sha1 hash.

Definition in file sha1.cpp.

Macro Definition Documentation

◆ F1

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

Helper value for SHA1's computing.

◆ F2

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

Helper value for SHA1's computing.

◆ F3

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

Helper value for SHA1's computing.

◆ F4

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

Helper value for SHA1's computing.

◆ K1

#define K1   0x5A827999L

Helper value for SHA1's computing.

◆ K2

#define K2   0x6ED9EBA1L

Helper value for SHA1's computing.

◆ K3

#define K3   0x8F1BBCDCL

Helper value for SHA1's computing.

◆ K4

#define K4   0xCA62C1D6L

Helper value for SHA1's computing.

◆ M

#define M (   i)
Value:
( tm = x[i & 0x0f] ^ x[(i - 14) & 0x0f] \
^ x[(i - 8) & 0x0f] ^ x[(i - 3) & 0x0f] \
, (x[i & 0x0f] = rol(tm, 1)) )

Helper value for SHA1's computing.

◆ R

#define R (   a,
  b,
  c,
  d,
  e,
  f,
  k,
 
)
Value:
do { e += rol(a, 5) \
+ f(b, c, d) \
+ k \
+ m; \
b = rol( b, 30 ); \
} while(0)

Helper value for SHA1's computing.

◆ X

#define X (   a)
Value:
do { *p++ = h##a >> 24; *p++ = h##a >> 16; \
*p++ = h##a >> 8; *p++ = h##a; } while(0)

Helper value for SHA1's computing.