Examples of digest()


Examples of java.security.MessageDigest.digest()

        MessageDigest digest=MessageDigest.getInstance("MD5");
        digest.reset();
        digest.update(encrypt.getDesKey().getEncoded());

        String symVersion=new String(digest.digest(), "UTF-8");

        encrypt.keyServer=false;
        Message msg=new Message();
        msg.setBuffer(cipher.doFinal("hello".getBytes()));
        msg.putHeader(ENCRYPT_ID, new EncryptHeader(EncryptHeader.ENCRYPT, symVersion));
View Full Code Here

Examples of java.security.MessageDigest.digest()

    }
    catch(UnsupportedEncodingException unsupportedEncodingException)
    {
    unsupportedEncodingException.printStackTrace();
    }//end of catch block
    byte raw[] = md.digest();
    String hash = (new BASE64Encoder()).encode(raw);
    return hash;
  }//end of encrypt(String plaintext)
  public static synchronized Password getInstance()
  {
View Full Code Here

Examples of java.security.MessageDigest.digest()

      ka.init(privateKey);
      ka.doPhase(publicKey, true);
      byte[] secret = ka.generateSecret();

      MessageDigest sha = MessageDigest.getInstance(DIGEST);
      byte[] hash = sha.digest(secret);
      byte[] symKey = new byte[keySize / 8];
      System.arraycopy(hash, 0, symKey, 0, symKey.length);
      return SymmetricCryptor.getSymmectricCryptor(symKey);
    } catch (NoSuchAlgorithmException e) {
      throw new CryptoException(e);
View Full Code Here

Examples of java.security.MessageDigest.digest()

        try {
            MessageDigest md = MessageDigest.getInstance("SHA");

            //Create the encrypted Byte[]
            md.update( password.getBytes() );
            byte[] hash = md.digest();

            //Convert the byte array into a String

            StringBuffer hashStringBuf = new StringBuffer();
            String byteString;
View Full Code Here

Examples of java.security.MessageDigest.digest()

         sha1Sun.update( raw );
        
         buffer.clear();
        }
       
        byte[] sun = sha1Sun.digest();
        sha1Sun.reset();
       
        byte[] gudy = sha1Gudy.digest();
        sha1Gudy.reset();
       
View Full Code Here

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

Examples of java.security.MessageDigest.digest()

    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

Examples of java.security.MessageDigest.digest()

        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

Examples of java.security.MessageDigest.digest()

    /* 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

Examples of java.security.MessageDigest.digest()

  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
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.