yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sha1.cpp File Reference
#include "sha1.h"
#include <sstream>
#include <iomanip>
#include <fstream>
+ Include dependency graph for sha1.cpp:

Go to the source code of this file.

Macros

#define SHA1_ROL(value, bits)   (((value) << (bits)) | (((value) & 0xffffffff) >> (32 - (bits))))
 
#define SHA1_BLK(i)   (block[i&15] = SHA1_ROL(block[(i+13)&15] ^ block[(i+8)&15] ^ block[(i+2)&15] ^ block[i&15],1))
 
#define SHA1_R0(v, w, x, y, z, i)   z += ((w&(x^y))^y) + block[i] + 0x5a827999 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);
 
#define SHA1_R1(v, w, x, y, z, i)   z += ((w&(x^y))^y) + SHA1_BLK(i) + 0x5a827999 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);
 
#define SHA1_R2(v, w, x, y, z, i)   z += (w^x^y) + SHA1_BLK(i) + 0x6ed9eba1 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);
 
#define SHA1_R3(v, w, x, y, z, i)   z += (((w|x)&y)|(w&x)) + SHA1_BLK(i) + 0x8f1bbcdc + SHA1_ROL(v,5); w=SHA1_ROL(w,30);
 
#define SHA1_R4(v, w, x, y, z, i)   z += (w^x^y) + SHA1_BLK(i) + 0xca62c1d6 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);
 

Functions

std::string sha1 (const std::string &string)
 

Macro Definition Documentation

#define SHA1_BLK (   i)    (block[i&15] = SHA1_ROL(block[(i+13)&15] ^ block[(i+8)&15] ^ block[(i+2)&15] ^ block[i&15],1))

Definition at line 27 of file sha1.cpp.

#define SHA1_R0 (   v,
  w,
  x,
  y,
  z,
 
)    z += ((w&(x^y))^y) + block[i] + 0x5a827999 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);

Definition at line 30 of file sha1.cpp.

#define SHA1_R1 (   v,
  w,
  x,
  y,
  z,
 
)    z += ((w&(x^y))^y) + SHA1_BLK(i) + 0x5a827999 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);

Definition at line 31 of file sha1.cpp.

#define SHA1_R2 (   v,
  w,
  x,
  y,
  z,
 
)    z += (w^x^y) + SHA1_BLK(i) + 0x6ed9eba1 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);

Definition at line 32 of file sha1.cpp.

#define SHA1_R3 (   v,
  w,
  x,
  y,
  z,
 
)    z += (((w|x)&y)|(w&x)) + SHA1_BLK(i) + 0x8f1bbcdc + SHA1_ROL(v,5); w=SHA1_ROL(w,30);

Definition at line 33 of file sha1.cpp.

#define SHA1_R4 (   v,
  w,
  x,
  y,
  z,
 
)    z += (w^x^y) + SHA1_BLK(i) + 0xca62c1d6 + SHA1_ROL(v,5); w=SHA1_ROL(w,30);

Definition at line 34 of file sha1.cpp.

#define SHA1_ROL (   value,
  bits 
)    (((value) << (bits)) | (((value) & 0xffffffff) >> (32 - (bits))))

Definition at line 26 of file sha1.cpp.

Function Documentation

std::string sha1 ( const std::string &  string)

Definition at line 270 of file sha1.cpp.

271 {
272  SHA1 checksum;
273  checksum.update(string);
274  return checksum.final();
275 }
Definition: sha1.h:28
std::string final()
Definition: sha1.cpp:69
void update(const std::string &s)
Definition: sha1.cpp:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function: