Java CRC32 Byte Array getCrc32(byte[] buf)

Here you can find the source of getCrc32(byte[] buf)

Description

Get the standard CRC32 checksum of a byte array.

License

GNU General Public License

Parameter

Parameter Description
buf The bytes to calculate the checksum of.

Return

The checksum.

Declaration

public static long getCrc32(byte[] buf) 

Method Source Code

//package com.java2s;
/*//from   www.jav  a2s  . c o  m
 * Copyright (C) 2015  University of Oregon
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Apache License, as specified in the LICENSE file.
 *
 * For more information, see the LICENSE file.
 */

import java.util.zip.CRC32;

public class Main {
    /**
     * Get the standard CRC32 checksum of a byte array.
     * @param buf The bytes to calculate the checksum of.
     * @return The checksum.
     */
    public static long getCrc32(byte[] buf) {
        CRC32 crc = new CRC32();
        crc.update(buf);
        return crc.getValue();
    }
}

Related

  1. crc32(String value)
  2. crc32Number(String s)
  3. crcBytes(byte[]... data)
  4. createRandomCrc32Hex()
  5. getCRC()
  6. getCRC32(String str)
  7. getCrc32asInt(byte[] in)
  8. getCRC32Checksum(byte[] bytes)
  9. getCRC32Checksum(String pString)