Commits

Dominic Kexel  committed 13bc407

added imperative version to C#

  • Participants
  • Parent commits 5070e74

Comments (0)

Files changed (1)

             var folded = data.Aggregate(seed, Proceed);
             return folded.Item2 << 16 | folded.Item1;
         }
+        
+        public static int Adler32_imp(byte[] data)
+        {
+            int a = 1;
+            int b = 0;
+
+            for (int n = 0; n < data.Length; n++) {
+                a = (a + data[n]) % BASE;
+                b = (b + a) % BASE;
+            }
+
+            return (b << 16) | a;
+        }
     }
 
     static class Programm