Selaa lähdekoodia

Use uppercase M[g]

Adolfo Martinelli 8 vuotta sitten
vanhempi
commit
05f9d7746a
1 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. 6 6
      Sources/CryptoSwift/MD5.swift

+ 6 - 6
Sources/CryptoSwift/MD5.swift

@@ -102,13 +102,13 @@ public final class MD5: DigestType {
             // break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15 and get M[g] value
             let gAdvanced = g << 2
 
-            let mg0 = UInt32(chunk[chunk.startIndex &+ gAdvanced])
-            let mg1 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 1]) << 8
-            let mg2 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 2]) << 16
-            let mg3 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 3]) << 24
-            let mg = (mg0 | mg1 | mg2) | mg3
+            let Mg0 = UInt32(chunk[chunk.startIndex &+ gAdvanced])
+            let Mg1 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 1]) << 8
+            let Mg2 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 2]) << 16
+            let Mg3 = UInt32(chunk[chunk.startIndex &+ gAdvanced &+ 3]) << 24
+            let Mg = (Mg0 | Mg1 | Mg2) | Mg3
 
-            B = B &+ rotateLeft(A &+ F &+ k[j] &+ mg, by: s[j])
+            B = B &+ rotateLeft(A &+ F &+ k[j] &+ Mg, by: s[j])
             A = dTemp
         }