hash - Unsigned Bytes CRC32 in Java -



hash - Unsigned Bytes CRC32 in Java -

i'm trying replicate crc32 hashing function available in php in java. existing crc32 class within java returns different hash , believe because java bytes in byte array unsigned -128 through 128 instead of 0-255.

what i'm failing figured out how work around situation. i've looked @ using guava's unsignedbytes, can't find hashing method takes argument. utilize write own hashing function, frankly don't plenty how works or bitwise arithmetic in general create plausible.

in simplest terms i'm trying crc32 has string , homecoming decimal representation.

crc not care sign.

java's crc32 gave me same result php's.

public static void main(string[] args) { string = "hello world!"; crc32 crc = new crc32(); crc.update(a.getbytes()); system.out.println(long.tohexstring(crc.getvalue())); }

outputs: 1c291ca3

using this online php crc32 calculator gave same crc value above java code.

java hash checksum crc32

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -