From 4643c57720a95b491adac3e4845e33739467eacf Mon Sep 17 00:00:00 2001 From: lomna-dev Date: Tue, 25 Apr 2023 20:14:37 +0530 Subject: [PATCH] Using UINT32_C Macro Refer to title --- nsha1.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nsha1.h b/nsha1.h index 8f1bb55..098d0d3 100644 --- a/nsha1.h +++ b/nsha1.h @@ -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];