Minor fix to SHA256: some indices were not being initted under some circumstances
authorDan
Wed, 19 Aug 2009 01:28:47 -0400
changeset 1080 6358f769ecb1
parent 1079 fcc42560afe6
child 1081 745200a9cc2a
child 1102 faef5e62e1e0
Minor fix to SHA256: some indices were not being initted under some circumstances
includes/diffiehellman.php
--- a/includes/diffiehellman.php	Mon Aug 10 22:43:26 2009 -0400
+++ b/includes/diffiehellman.php	Wed Aug 19 01:28:47 2009 -0400
@@ -141,6 +141,8 @@
       $HASH = Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
       $W = Array(64);
       /* append padding */
+      if ( !isset($m[$l >> 5]) )
+        $m[$l >> 5] = 0;
       $m[$l >> 5] |= 0x80 << (24 - $l % 32);
       $m[(($l + 64 >> 9) << 4) + 15] = $l;
       for ( $i = 0; $i<count($m); $i+=16 ) {