digitalmars.D.learn - calculating CRC32
I'm trying to calculate CRC32 and it keeps giving me the wrong result.void main(string[] args) { CRC32Digest test = new CRC32Digest(); ubyte[] data = [1,5,2,3,4]; test.put(data); auto data2 = test.finish(); writeln((data2[0] << 24) | (data2[1] << 16) | ((data2[2]) << 8) | (data2[3])); writeln((data2[0]) | (data2[1] << 8) | ((data2[2]) << 16) | (data2[3] << 24)); }this writes out728586467 -480744149but when calculating CRC32 with java, I get3814223147Not sure what I'm doing wrong. I tried reversing data[] as well.
Apr 08 2016