SHA2 renamed to SHA256, SHA4 renamed to SHA512 and functions accordingly
The SHA4 name was not clear with regards to the new SHA-3 standard. So
SHA2 and SHA4 have been renamed to better represent what they are:
SHA256 and SHA512 modules.
diff --git a/programs/hash/sha2sum.c b/programs/hash/sha2sum.c
index 83124cf..81a8058 100644
--- a/programs/hash/sha2sum.c
+++ b/programs/hash/sha2sum.c
@@ -1,5 +1,5 @@
/*
- * sha2sum demonstration program
+ * sha256sum demonstration program
*
* Copyright (C) 2006-2011, Brainspark B.V.
*
@@ -34,19 +34,19 @@
#include "polarssl/sha2.h"
-#if !defined(POLARSSL_SHA2_C) || !defined(POLARSSL_FS_IO)
+#if !defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
{
((void) argc);
((void) argv);
- printf("POLARSSL_SHA2_C and/or POLARSSL_FS_IO not defined.\n");
+ printf("POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-static int sha2_wrapper( char *filename, unsigned char *sum )
+static int sha256_wrapper( char *filename, unsigned char *sum )
{
- int ret = sha2_file( filename, sum, 0 );
+ int ret = sha256_file( filename, sum, 0 );
if( ret == 1 )
fprintf( stderr, "failed to open: %s\n", filename );
@@ -57,12 +57,12 @@
return( ret );
}
-static int sha2_print( char *filename )
+static int sha256_print( char *filename )
{
int i;
unsigned char sum[32];
- if( sha2_wrapper( filename, sum ) != 0 )
+ if( sha256_wrapper( filename, sum ) != 0 )
return( 1 );
for( i = 0; i < 32; i++ )
@@ -72,7 +72,7 @@
return( 0 );
}
-static int sha2_check( char *filename )
+static int sha256_check( char *filename )
{
int i;
size_t n;
@@ -110,7 +110,7 @@
nb_tot1++;
- if( sha2_wrapper( line + 66, sum ) != 0 )
+ if( sha256_wrapper( line + 66, sum ) != 0 )
{
nb_err1++;
continue;
@@ -151,8 +151,8 @@
if( argc == 1 )
{
- printf( "print mode: sha2sum <file> <file> ...\n" );
- printf( "check mode: sha2sum -c <checksum file>\n" );
+ printf( "print mode: sha256sum <file> <file> ...\n" );
+ printf( "check mode: sha256sum -c <checksum file>\n" );
#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
@@ -163,12 +163,12 @@
}
if( argc == 3 && strcmp( "-c", argv[1] ) == 0 )
- return( sha2_check( argv[2] ) );
+ return( sha256_check( argv[2] ) );
ret = 0;
for( i = 1; i < argc; i++ )
- ret |= sha2_print( argv[i] );
+ ret |= sha256_print( argv[i] );
return( ret );
}
-#endif /* POLARSSL_SHA2_C && POLARSSL_FS_IO */
+#endif /* POLARSSL_SHA256_C && POLARSSL_FS_IO */