public boolean authenticateUserPassword(String userPassword) {
        // Step 1: Perform all but the last step of Algorithm 3.4(Revision 2) or
        // Algorithm 3.5 (Revision 3) using the supplied password string.
        byte[] tmpUValue = calculateUserPassword(userPassword);

        byte[] bigU = Utils.convertByteCharSequenceToByteArray(
                encryptionDictionary.getBigU());

        byte[] trunkUValue;
        // compare all 32 bytes.
        if (encryptionDictionary.getRevisionNumber() == 2) {
            trunkUValue = new byte[32];
            System.arraycopy(tmpUValue, 0, trunkUValue, 0, trunkUValue.length);
        }
        // truncate to first 16 bytes for R >= 3
        else if (encryptionDictionary.getRevisionNumber() >= 3 &&
                encryptionDictionary.getRevisionNumber() < 5) {
            trunkUValue = new byte[16];
            System.arraycopy(tmpUValue, 0, trunkUValue, 0, trunkUValue.length);
        } else {
            return false;
        }

        // Step 2: If the result of step 1 is equal o the value of the
        // encryption dictionary's U entry, the password supplied is the correct
        // user password.

        boolean found = true;
        for (int i = 0; i < trunkUValue.length; i++) {
            if (trunkUValue[i] != bigU[i]) {
                found = false;
                break;
            }
        }
        return found;
    }