Using UINT32_C Macro

Refer to title
main
lomna-dev 1 year ago
parent b20a0deed9
commit 4643c57720

@ -23,11 +23,11 @@ NSHA1_Result nsha1file(char *filename){
uint32_t size_in_bytes = 0;
uint64_t size_in_bits = 0;
uint32_t h0 = 0x67452301;
uint32_t h1 = 0xefcdab89;
uint32_t h2 = 0x98badcfe;
uint32_t h3 = 0x10325476;
uint32_t h4 = 0xc3d2e1f0;
uint32_t h0 = UINT32_C(0x67452301);
uint32_t h1 = UINT32_C(0xefcdab89);
uint32_t h2 = UINT32_C(0x98badcfe);
uint32_t h3 = UINT32_C(0x10325476);
uint32_t h4 = UINT32_C(0xc3d2e1f0);
file = fopen(filename,"r");
if(errno != 0){
@ -89,16 +89,16 @@ NSHA1_Result nsha1file(char *filename){
for(int i = 0; i < 80; i++){
if(i >= 0 && i <= 19){
f = (b & c) ^ ((~b) & d);
k = 0x5a827999;
k = UINT32_C(0x5a827999);
}else if ( i >= 20 && i <= 39){
f = b ^ c ^ d;
k = 0x6ed9eba1;
k = UINT32_C(0x6ed9eba1);
}else if (i >= 40 && i <= 59){
f = (b & c) ^ (b & d) ^ (c & d);
k = 0x8f1bbcdc;
k = UINT32_C(0x8f1bbcdc);
}else if (i >= 60 && i <= 79){
f = b ^ c ^ d;
k = 0xca62c1d6;
k = UINT32_C(0xca62c1d6);
}
uint32_t temp = leftRotate32(a,5) + f + e + k + w[i];

Loading…
Cancel
Save