Class ChecksumUtils

java.lang.Object
org.apache.juneau.commons.utils.ChecksumUtils

public class ChecksumUtils extends Object
Content-checksum utility methods.
  • Method Details

    • hash8

      public static String hash8(byte[] bytes)
      Formats a CRC32 checksum of the specified bytes as a zero-padded, lower-case, 8-hex-char content hash.

      Suitable as a compact, content-sensitive cache-buster for classpath-shipped assets (JS/CSS/images, etc.): the hash changes the instant the underlying bytes do, without relying on a build/version string alone (which stays stable across -SNAPSHOT dev rebuilds and so cannot bust a browser's cache on its own).

      Parameters:
      bytes - The bytes to checksum. Must not be null.
      Returns:
      The zero-padded 8-hex-char CRC32 checksum (e.g. "1a2b3c4d").