Code example for MessageDigest

Methods: digestresetupdate

0
     * @param datas the datas to hash. 
     * @return the hash under bytes array format. 
     */ 
    public byte[] hash( byte[] datas )
    { 
        algorithm.reset();
        algorithm.update( datas );
        return algorithm.digest();
    } 
 
    /** 
     * Hashes the specified chars array. 
     * 
     * @param chars the chars to hash. 
     * @return the hash under bytes array format. 
     */ 
    public byte[] hash( char[] chars )
    { 
        byte[] bytes = toByteArray( chars );
        return hash( bytes );