public byte[] toHashedBytes(byte[] bytes) throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance(algorithm.toString());
        return messageDigest.digest(bytes);
    }
public byte [ ] toHashedBytes ( byte [ ] bytes ) throws NoSuchAlgorithmException { MessageDigest messageDigest = MessageDigest . getInstance ( algorithm . toString ( ) ) ; return messageDigest . digest ( bytes ) ; }
Hashes the input bytes into a hashed byte[] -- no special encoding.
<ul>
<li>MD5 - hash is always 16 bytes
<li>SHA1 - hash is always 20 bytes
<li>SHA256 - hash is always 32 bytes
<li>SHA512 - hash is always 64 bytes
</ul>
@param bytes The bytes to hash
@return The hashed byte[]
@throws NoSuchAlgorithmException