Code example for MessageDigest

Methods: clonegetDigestLength

0
  private final boolean supportsClone;
  private final String toString;
 
  MessageDigestHashFunction(String algorithmName, String toString) {
    this.prototype = getMessageDigest(algorithmName);
    this.bytes = prototype.getDigestLength();
    this.toString = checkNotNull(toString);
    this.supportsClone = supportsClone();
  } 
 
  MessageDigestHashFunction(String algorithmName, int bytes, String toString) {
    this.toString = checkNotNull(toString);
    this.prototype = getMessageDigest(algorithmName);
    int maxLength = prototype.getDigestLength();
    checkArgument(bytes >= 4 && bytes <= maxLength,
        "bytes (%s) must be >= 4 and < %s", bytes, maxLength);
    this.bytes = bytes;
    this.supportsClone = supportsClone();
  } 
 
  private boolean supportsClone() { 
    try { 
      prototype.clone();
      return true; 
    } catch (CloneNotSupportedException e) {
      return false; 
    } 
  } 
Contextual code suggestions in your IDE  Get Codota for Java