#include "sha1.h"
#include <sstream>
#include <iomanip>
#include <fstream>
Go to the source code of this file.
|
#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); |
|
|
std::string | sha1 (const std::string &string) |
|
#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); |
#define SHA1_ROL |
( |
|
value, |
|
|
|
bits |
|
) |
| (((value) << (bits)) | (((value) & 0xffffffff) >> (32 - (bits)))) |
std::string sha1 |
( |
const std::string & |
string | ) |
|
Definition at line 270 of file sha1.cpp.
274 return checksum.
final();
void update(const std::string &s)