comparison dcrypt/misc/checksums/Adler32.d @ 28:ad687db713a4

Further reworked the code for hash padding. Replaced all instances of 'char[]' with 'string' and removed a few 'const' modifiers as per Glenn Haecker's patch for D2 compatibility. Updated CONTRIBUTORS file.
author Thomas Dixon <reikon@reikon.us>
date Sun, 10 May 2009 22:38:48 -0400
parents 176c933827a8
children 21847420b1ac
comparison
equal deleted inserted replaced
27:8b5eaf3c2979 28:ad687db713a4
31 } 31 }
32 32
33 return (s2 << 16) + s1; 33 return (s2 << 16) + s1;
34 } 34 }
35 35
36 char[] name() { 36 string name() {
37 return "Adler32"; 37 return "Adler32";
38 } 38 }
39 39
40 debug (UnitTest) { 40 debug (UnitTest) {
41 unittest { 41 unittest {
42 static char[][] test_inputs = [ 42 static string[] test_inputs = [
43 "", 43 "",
44 "a", 44 "a",
45 "checksum", 45 "checksum",
46 "chexksum" 46 "chexksum"
47 ]; 47 ];
52 0xea10354u, 52 0xea10354u,
53 0xf0a0369u 53 0xf0a0369u
54 ]; 54 ];
55 55
56 Adler32 adler32 = new Adler32; 56 Adler32 adler32 = new Adler32;
57 foreach (uint i, char[] j; test_inputs) 57 foreach (uint i, string j; test_inputs)
58 assert(adler32.compute(j) == test_results[i], adler32.name); 58 assert(adler32.compute(j) == test_results[i], adler32.name);
59 } 59 }
60 } 60 }
61 } 61 }