Code example for MessageDigest

Methods: digest, update

0
    } 
  } 
 
  @Override 
  public synchronized byte[] hash(String key) {
    hashfunction.update(key.getBytes());
    return hashfunction.digest();
 
  } 
   
  public synchronized byte[] hash(byte[] bytes) {
    hashfunction.update(bytes);
    return hashfunction.digest();
  } 
 
  public static SHA1HashFunction getInstance() { 
    return SHA1HashFunctionHolder.INSTANCE;
  } 
 
  private static class SHA1HashFunctionHolder {