Code example for MessageDigest

Methods: digestresetupdate

0
		byte chapIdentifier = (byte) random.nextInt(256);
		byte[] chapPassword = new byte[17];
		chapPassword[0] = chapIdentifier;
 
		MessageDigest md5 = getMd5Digest();
		md5.reset();
		md5.update(chapIdentifier);
		md5.update(RadiusUtil.getUtf8Bytes(plaintext));
		byte[] chapHash = md5.digest(chapChallenge);
 
		System.arraycopy(chapHash, 0, chapPassword, 1, 16);
		return chapPassword;
	} 
 
	/** 
	 * Verifies a CHAP password against the given plaintext password. 
	 *  
	 * @return plain-text password 
	 */ 
	private boolean verifyChapPassword(String plaintext) throws RadiusException {
Contextual code suggestions in your IDE  Get Codota for Java