]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
gost12sum gives the same hash strings as openssl dgst does
authorDmitry Belyavskiy <beldmit@gmail.com>
Sun, 20 Aug 2017 13:17:24 +0000 (16:17 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Sun, 20 Aug 2017 13:17:24 +0000 (16:17 +0300)
gost12sum.1
gost12sum.c

index da5fc5ecea2c9757080e180ec3246023d37626b6..9c49e18012032c62bf3666f870a57136e902a8c0 100644 (file)
@@ -65,12 +65,6 @@ Be more verbose. Print filenames when checking (with \-c).
 .B -l 
 Use long (512-bit) hash instead of short (256-bit).
 
-.SH CAVEATS
-
-The output of gost12sum has a reversed byte order compared to output of 
-.B openssl dgst
-command because of the Russian GOST requrements. 
-
 .SH BUGS
 
 This manpage is not quite accurate and has formatting inconsistent
index 887eb1c0984d422a9c48efa5ef6e84863ad544f0..4936d7e4b27217edeafd4ac3e1f6cae20d86be83 100644 (file)
@@ -34,18 +34,17 @@ int hash_file(gost_hash_ctx * ctx, char *filename, char *sum, int mode);
 int hash_stream(gost_hash_ctx * ctx, int fd, char *sum);
 int get_line(FILE *f, char *hash, char *filename, int verbose);
 
-void help(const char *progname)
+void help()
 {
     fprintf(stderr, "Calculates GOST R 34.11-2012 hash function\n\n");
-    fprintf(stderr, "%s [-bvl] [-c [file]]| [files]|-x\n"
+    fprintf(stderr, "gostsum12 [-bvl] [-c [file]]| [files]|-x\n"
             "\t-c check message digests (default is generate)\n"
             "\t-v verbose, print file names when checking\n"
             "\t-b read files in binary mode\n"
             "\t-l use 512 bit hash (default 256 bit)\n"
             "\t-x read filenames from stdin rather than from arguments \n"
             "The input for -c should be the list of message digests and file names\n"
-                  "that is printed on stdout by this program when it generates"
-                  "digests.\n", progname);
+            "that is printed on stdout by this program when it generates digests.\n");
     exit(3);
 }
 
@@ -108,7 +107,7 @@ int main(int argc, char **argv)
             break;
         default:
             fprintf(stderr, "invalid option %c", optopt);
-            help(argv[0]);
+            help();
         }
     }
     if (check_file) {
@@ -227,7 +226,7 @@ int hash_stream(gost_hash_ctx * ctx, int fd, char *sum)
     }
     finish_hash12(ctx, buffer);
     for (i = 0; i < (hashsize / 8); i++) {
-        sprintf(sum + 2 * i, "%02x", buffer[hashsize/8-1-i]);
+        sprintf(sum + 2 * i, "%02x", buffer[i]);
     }
     return 1;
 }