Package java.security

Examples of java.security.MessageDigest.digest()


        md5.update((byte)(packetLength >> 8));
        md5.update((byte)(packetLength & 0x0ff));
        md5.update(requestAuthenticator, 0, requestAuthenticator.length);
        md5.update(attributes, 0, attributes.length);
        md5.update(RadiusUtil.getUtf8Bytes(sharedSecret));
        return md5.digest();   
  }

  /**
   * Reads a Radius packet from the given input stream and
   * creates an appropiate RadiusPacket descendant object.
View Full Code Here


        md5.update((byte)(packetLength >> 8));
        md5.update((byte)(packetLength & 0xff));
        md5.update(authenticator, 0, authenticator.length);
        md5.update(attributes, 0, attributes.length);
        md5.update(RadiusUtil.getUtf8Bytes(sharedSecret));
        return md5.digest();
  }
 
  /**
   * Checks the received request authenticator as specified by RFC 2866.
   */
 
View Full Code Here

   
    for (int i = 0; i < encryptedPass.length; i+=16) {
      md5.reset();
      md5.update(sharedSecret);
      md5.update(i == 0 ? getAuthenticator() : lastBlock);
      byte bn[] = md5.digest();
       
      System.arraycopy(encryptedPass, i, lastBlock, 0, 16);
   
      // perform the XOR as specified by RFC 2865.
      for (int j = 0; j < 16; j++)
View Full Code Here

   
    for (int i = 0; i < encryptedPass.length; i+=16) {
      md5.reset();
      md5.update(sharedSecret);
      md5.update(i == 0 ? getAuthenticator() : lastBlock);
      byte bn[] = md5.digest();
       
      System.arraycopy(encryptedPass, i, lastBlock, 0, 16);
   
      // perform the XOR as specified by RFC 2865.
      for (int j = 0; j < 16; j++)
View Full Code Here

        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;
  }
View Full Code Here

    byte chapIdentifier = chapPassword[0];
    MessageDigest md5 = getMd5Digest();
      md5.reset();
      md5.update(chapIdentifier);
      md5.update(RadiusUtil.getUtf8Bytes(plaintext));
      byte[] chapHash = md5.digest(chapChallenge);
     
      // compare
      for (int i = 0; i < 16; i++)
        if (chapHash[i] != chapPassword[i + 1])
          return false;
View Full Code Here

  public static String getMD5(final String data) {
    try {
      MessageDigest m = MessageDigest.getInstance("MD5");
      m.reset();
      m.update(data.getBytes());
      BigInteger bigInt = new BigInteger(1, m.digest());
      String hashtext = bigInt.toString(16);
      while(hashtext.length() < 32 ){
          hashtext = "0" + hashtext;
      }
      return hashtext;
View Full Code Here

    md5.update((byte) (packetLength >> 8));
    md5.update((byte) (packetLength & 0xff));
    md5.update(authenticator, 0, authenticator.length);
    md5.update(attributes, 0, attributes.length);
    md5.update(RadiusUtil.getUtf8Bytes(sharedSecret));
    return md5.digest();
  }
 
}
View Full Code Here

      MessageDigest md      = null;
      encoder = new BASE64Encoder();
      md = MessageDigest.getInstance(algName);
      md.reset();
      md.update(text.getBytes());
      return encoder.encode(md.digest());

    }
   
    /**
     * Errechnet den MD5-Code eines Strings<br>
View Full Code Here

        MessageDigest md = null;
        md = MessageDigest.getInstance("MD5");
        md.reset();
        md.update(str.getBytes());

        return toHexString(md.digest());
    }
   
    /**
     * Errechnet den MD5-Code einer Datei<br>
     * Dieser Code ist eine hexadezimale Zahl mit 32 Zeichen L�nge.<br>
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.