Fossil SCM

Bug fix in the sha3sum() routine. Also comment-out that routine since it is not used anyplace in the code.

drh 2017-06-06 17:53 trunk
Commit 6419592d659a2194d63df5f7cfec0e8c511ed1c99ad9b039ff10704f6172a0aa
1 file changed +3 -1
+3 -1
--- src/sha3.c
+++ src/sha3.c
@@ -600,10 +600,11 @@
600600
blob_resize(pCksum, iSize/4);
601601
DigestToBase16(SHA3Final(&ctx), blob_buffer(pCksum), iSize/8);
602602
return 0;
603603
}
604604
605
+#if 0 /* NOT USED */
605606
/*
606607
** Compute the SHA3 checksum of a zero-terminated string. The
607608
** result is held in memory obtained from mprintf().
608609
*/
609610
char *sha3sum(const char *zIn, int iSize){
@@ -610,13 +611,14 @@
610611
SHA3Context ctx;
611612
char zDigest[132];
612613
613614
SHA3Init(&ctx, iSize);
614615
SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
615
- DigestToBase16(SHA3Final(&ctx), zDigest, iSize/4);
616
+ DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8);
616617
return mprintf("%s", zDigest);
617618
}
619
+#endif
618620
619621
/*
620622
** COMMAND: sha3sum*
621623
**
622624
** Usage: %fossil sha3sum FILE...
623625
--- src/sha3.c
+++ src/sha3.c
@@ -600,10 +600,11 @@
600 blob_resize(pCksum, iSize/4);
601 DigestToBase16(SHA3Final(&ctx), blob_buffer(pCksum), iSize/8);
602 return 0;
603 }
604
 
605 /*
606 ** Compute the SHA3 checksum of a zero-terminated string. The
607 ** result is held in memory obtained from mprintf().
608 */
609 char *sha3sum(const char *zIn, int iSize){
@@ -610,13 +611,14 @@
610 SHA3Context ctx;
611 char zDigest[132];
612
613 SHA3Init(&ctx, iSize);
614 SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
615 DigestToBase16(SHA3Final(&ctx), zDigest, iSize/4);
616 return mprintf("%s", zDigest);
617 }
 
618
619 /*
620 ** COMMAND: sha3sum*
621 **
622 ** Usage: %fossil sha3sum FILE...
623
--- src/sha3.c
+++ src/sha3.c
@@ -600,10 +600,11 @@
600 blob_resize(pCksum, iSize/4);
601 DigestToBase16(SHA3Final(&ctx), blob_buffer(pCksum), iSize/8);
602 return 0;
603 }
604
605 #if 0 /* NOT USED */
606 /*
607 ** Compute the SHA3 checksum of a zero-terminated string. The
608 ** result is held in memory obtained from mprintf().
609 */
610 char *sha3sum(const char *zIn, int iSize){
@@ -610,13 +611,14 @@
611 SHA3Context ctx;
612 char zDigest[132];
613
614 SHA3Init(&ctx, iSize);
615 SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
616 DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8);
617 return mprintf("%s", zDigest);
618 }
619 #endif
620
621 /*
622 ** COMMAND: sha3sum*
623 **
624 ** Usage: %fossil sha3sum FILE...
625

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button