@Test public void testCrc32() { assertEquals(getCrc32(null), DigestUtils.crc32(null)); String testStr = "{\"log\":{\"content\":\"2\",\"time\":\"2016-01-05 10:17:24\",\"type\":1001,\"version\":\"[5.0.8.12]\"},\"pcInfo\":{\"ip\":\"192.168.118.57\",\"mac\":\"94-DE-80-A8-E6-EC\",\"onlyId\":\"7CE81DDBF7D05F6AD89CD7D79FAA5905\"},\"user\":{\"name\":\"CFM\"}}"; assertEquals(getCrc32(testStr.getBytes()), DigestUtils.crc32(testStr.getBytes())); assertEquals(getCrc32(TypeUtils.long2ByteArray(123456L)), DigestUtils.crc32(TypeUtils.long2ByteArray(123456L))); }
public static long crc32(byte[] bytes) { CRC32 crc32 = new CRC32(); if (bytes != null) { crc32.update(bytes); } return crc32.getValue(); }
DigestUtils { public static long crc32(byte[] bytes) { CRC32 crc32 = new CRC32(); if (bytes != null) { crc32.update(bytes); } return crc32.getValue(); } }
DigestUtils { public static long crc32(byte[] bytes) { CRC32 crc32 = new CRC32(); if (bytes != null) { crc32.update(bytes); } return crc32.getValue(); } private  DigestUtils(); }
DigestUtils { public static long crc32(byte[] bytes) { CRC32 crc32 = new CRC32(); if (bytes != null) { crc32.update(bytes); } return crc32.getValue(); } private  DigestUtils(); static String uuid(); static long crc32(byte[] bytes); static String toBase64(byte[] input); static byte[] fromBase64(String base64); static void importCert2Keystore(String keystorePath, String password, String host, int port); static String md5(String src); static String md5(String src, EncodeType encodeType); static String sha1(String src); static String sha1(String src, EncodeType encodeType); static String sha256(String src); static String sha256(String src, EncodeType encodeType); }
DigestUtils { public static long crc32(byte[] bytes) { CRC32 crc32 = new CRC32(); if (bytes != null) { crc32.update(bytes); } return crc32.getValue(); } private  DigestUtils(); static String uuid(); static long crc32(byte[] bytes); static String toBase64(byte[] input); static byte[] fromBase64(String base64); static void importCert2Keystore(String keystorePath, String password, String host, int port); static String md5(String src); static String md5(String src, EncodeType encodeType); static String sha1(String src); static String sha1(String src, EncodeType encodeType); static String sha256(String src); static String sha256(String src, EncodeType encodeType);  }