Convert String to CRC32 - Java Security

Java examples for Security:CRC

Description

Convert String to CRC32

Demo Code


import java.util.zip.CRC32;

public class Main {

    public static void main(String[] args) {
        String src = "this is a test";
        CRC32 crc = new CRC32();
        crc.update(src.getBytes());//from  w w w. j  a va2 s.c  om
        String hex = Long.toHexString(crc.getValue());
        System.out.println("jdk crc32 : " + hex);
    }

}

Related Tutorials