Probably last commit

This is probably going to be the last commit lmao.
main
lomna-dev 1 year ago
parent d72e042ce2
commit b20a0deed9

@ -1,4 +1,4 @@
# nsha1 # Not sha1
This was a failed attempt to create SHA1 algorithm in C. The algorithm achieved still seems sensitive to small changes in text files. So maybe it can be used in stuff like VCS and build systems. This was a failed attempt to create SHA1 algorithm in C. The algorithm achieved still seems sensitive to small changes in text files. So maybe it can be used in stuff like VCS and build systems.
@ -18,6 +18,6 @@ python3 flow clean
The "library" is only adding: The "library" is only adding:
1. NSHA1_Result strcut to store result 1. NSHA1_Result struct to store result
2. nsha1file, a function to get nsha1 of a file. 2. nsha1file, a function to get nsha1 of a file.
3. leftRotate32, a macro to circular shift 32 bit unsigned integers. 3. leftRotate32, a macro to circular shift 32 bit unsigned integers.

@ -44,8 +44,6 @@ NSHA1_Result nsha1file(char *filename){
bytes_read = fread(buffer, 1, 64, file); bytes_read = fread(buffer, 1, 64, file);
number_of_chuncks++; number_of_chuncks++;
// printf("We read %d bytes\n", bytes_read);
if(bytes_read != 64){ if(bytes_read != 64){
// * We need to convert to 512 bit * // // * We need to convert to 512 bit * //
size_in_bytes += bytes_read; // the final size is done here size_in_bytes += bytes_read; // the final size is done here
@ -66,14 +64,6 @@ NSHA1_Result nsha1file(char *filename){
lastRound = 1; // This is the last round lastRound = 1; // This is the last round
} }
/**
// Printing each byte of the chunk
printf("------------------------------------------\n");
for(int i = 0; i < 64; i++)
printf("%x i=%d\n", buffer[i], i);
printf("------------------------------------------\n");
**/
// * We usually get a 512 bit chunk except the last chunck which we need to pad (which we do in the if above) * // // * We usually get a 512 bit chunk except the last chunck which we need to pad (which we do in the if above) * //
size_in_bytes += 64; size_in_bytes += 64;
@ -85,15 +75,6 @@ NSHA1_Result nsha1file(char *filename){
for(int i = 16; i < 80; i++) for(int i = 16; i < 80; i++)
w[i] = leftRotate32( w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i - 16] , 1 ); w[i] = leftRotate32( w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i - 16] , 1 );
/**
// Printing each w for the chunck
printf("------------------------------------------\n");
for(int i = 0; i < 80; i++)
printf("%x i=%d\n", w[i], i);
printf("------------------------------------------\n");
**/
uint32_t a = h0; uint32_t a = h0;
uint32_t b = h1; uint32_t b = h1;

Loading…
Cancel
Save