Package java.security

Examples of java.security.MessageDigest.digest()


    byte[] magicKeyChar = do0x0bMagic3(magicLength, magic);

    // Get password and crypt hashes as per usual.
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    md5.update(password.getBytes());
    char[] result = Util.byteArrayToCharArray(md5.digest());
    char[] passwordHash = toBase64(result);

    md5.reset();
    byte[] cryptResult = crypt(password, "$1$_2S43d5f$");
    md5.update(cryptResult);
View Full Code Here


    char[] passwordHash = toBase64(result);

    md5.reset();
    byte[] cryptResult = crypt(password, "$1$_2S43d5f$");
    md5.update(cryptResult);
    result = Util.byteArrayToCharArray(md5.digest());
    char[] cryptHash = toBase64(result);

    // Our first authentication response is based off the password hash.
    String resp6 = get0x0bResponseString(passwordHash, magicKeyChar);
    // Our second authentication response is based off the crypto hash.
View Full Code Here

        chal[4] = (byte) i;
        chal[5] = (byte) (i >> 8);
        chal[6] = (byte) j;
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        md5.update(chal);
        byte[] result = md5.digest();
        if (Arrays.equals(compare, result)) {
          depth = i;
          table = j;
          done = true;
        }
View Full Code Here

    /* The second context gets the password hash XORed
     * with 0x5c plus the SHA-1 digest of the first context. */
    sha2.update(hashXOR2);
    sha2.update(digest1);
    char[] digest2 = Util.byteArrayToCharArray(sha2.digest());

    /* Now that we have digest2, use it to fetch characters from
     * an alphabet to construct our first authentication response. */
    char[] alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ".toCharArray();
    char[] alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop".toCharArray();
View Full Code Here

  private String[] doPre0x0bEncrypt() throws NoSuchAlgorithmException {
    MessageDigest md5 = MessageDigest.getInstance("MD5");

    md5.update(password.getBytes());
    char[] result = Util.byteArrayToCharArray(md5.digest());
    char[] passwordHash = toBase64(result);

    md5.reset();
    byte[] cryptResult = crypt(password, "$1$_2S43d5f$");
    md5.update(cryptResult);
View Full Code Here

    char[] passwordHash = toBase64(result);

    md5.reset();
    byte[] cryptResult = crypt(password, "$1$_2S43d5f$");
    md5.update(cryptResult);
    result = Util.byteArrayToCharArray(md5.digest());
    char[] cryptHash = toBase64(result);

    int sv = seed[15] % 8;
    char checksum = 0;
    String hashStringP = null, hashStringC = null;
View Full Code Here

        break;
    }

    md5.reset();
    md5.update(hashStringP.getBytes());
    result = Util.byteArrayToCharArray(md5.digest());
    char[] result6 = toBase64(result);

    md5.reset();
    md5.update(hashStringC.getBytes());
    result = Util.byteArrayToCharArray(md5.digest());
View Full Code Here

    result = Util.byteArrayToCharArray(md5.digest());
    char[] result6 = toBase64(result);

    md5.reset();
    md5.update(hashStringC.getBytes());
    result = Util.byteArrayToCharArray(md5.digest());
    char[] result96 = toBase64(result);

    String ret[] = new String[2];
    ret[0] = new String(result6);
    ret[1] = new String(result96);
View Full Code Here

    // Add key again.
    md2.update(key.getBytes());

    // Now get result of this (16 bytes) and add it to the other context.
    byte[] altResult = md2.digest();

    // Add for any character in the key one byte of the alternate sum.
    int cnt;
    for (cnt = key.length(); cnt > 16; cnt -= 16)
      md1.update(altResult, 0, 16);
View Full Code Here

  {
    MessageDigest md = MessageDigest.getInstance("MD5");

    md.update(str.getBytes());

    byte[] b = md.digest();
    StringBuffer sb = new StringBuffer();

    for(int i = 0; i < b.length; i++)
    {
      int v = (int) b[i];
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.