Merge pull request #122 from libtom/fix/122
adler32 vs. crc32 inconsistency
This commit is contained in:
		
						commit
						78e9b0fca8
					
				@ -175,7 +175,7 @@ void crc32_finish(crc32_state *ctx, void *hash, unsigned long size)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   if (size > 4) size = 4;
 | 
					   if (size > 4) size = 4;
 | 
				
			||||||
   for (i = 0; i < size; i++) {
 | 
					   for (i = 0; i < size; i++) {
 | 
				
			||||||
      h[i] = ((unsigned char*)&(crc))[i];
 | 
					      h[i] = ((unsigned char*)&(crc))[size-i-1];
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -185,7 +185,7 @@ int crc32_test(void)
 | 
				
			|||||||
   return CRYPT_NOP;
 | 
					   return CRYPT_NOP;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
   const void* in = "libtomcrypt";
 | 
					   const void* in = "libtomcrypt";
 | 
				
			||||||
   const unsigned char crc32[] = { 0xef, 0x76, 0x73, 0xb3 };
 | 
					   const unsigned char crc32[] = { 0xb3, 0x73, 0x76, 0xef };
 | 
				
			||||||
   unsigned char out[4];
 | 
					   unsigned char out[4];
 | 
				
			||||||
   crc32_state ctx;
 | 
					   crc32_state ctx;
 | 
				
			||||||
   crc32_init(&ctx);
 | 
					   crc32_init(&ctx);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user