public static String digest(byte[] self, String algorithm) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance(algorithm);
        md.update(ByteBuffer.wrap(self));

        return encodeHex(md.digest()).toString();
    }
public static String digest ( byte [ ] self , String algorithm ) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest . getInstance ( algorithm ) ; md . update ( ByteBuffer . wrap ( self ) ) ; return encodeHex ( md . digest ( ) ) . toString ( ) ; }
digest the byte array
@param algorithm the name of the algorithm requested, e.g. MD5, SHA-1, SHA-256, etc.
@return digested value
@throws NoSuchAlgorithmException if the algorithm not found
@since 2.5.0
@see MessageDigest#getInstance(java.lang.String)