[Demonstration 1]

[Buggy Method]
private BigInteger encryptDecrypt(BigInteger message, BigInteger key) {
    return message.modPow(key, getN());
}

[Buggy Hunk]
private BigInteger encryptDecrypt(BigInteger message, BigInteger key){

[Patch]
private BigInteger encryptDecrypt(BigInteger key, BigInteger message){

[Demonstration 2]

[Buggy Method]
private Formula pushNots(Formula f) {
    if (f instanceof Not) {
        Not tmp = (Not) f;
        if (tmp.formula instanceof Not) {
            f = ((Not) tmp.formula).formula;
            f = pushNots(f);
        } else if (tmp.formula instanceof And) {
            And t = (And) tmp.formula;
            f = new Or(new Not(t.left), new Not(t.right));
            f = pushNots(f);
        } else if (tmp.formula instanceof Or) {
            Or t = (Or) tmp.formula;
            f = new And(new Not(t.left), new Not(t.right));
            f = pushNots(f);
        } else if (tmp.formula instanceof ForAll) {
            ForAll t = (ForAll) tmp.formula;
            f = new ThereExist(t.var, new Not(t.formula));
            f = pushNots(f);
        } else if (tmp.formula instanceof ThereExist) {
            ThereExist t = (ThereExist) tmp.formula;
            f = new ForAll(t.var, new Not(t.formula));
            f = pushNots(f);
        }
    } else if (f instanceof BinaryOperator) {
        ((BinaryOperator) f).left = pushNots(((BinaryOperator) f).left);
        ((BinaryOperator) f).right = pushNots(((BinaryOperator) f).right);
    } else if (f instanceof Quantifier) {
        ((Quantifier) f).formula = removeImplications(((Quantifier) f).formula);
    } else if (f instanceof Predict) {
        // Do Nothing
    }
    return f;
}

[Buggy Hunk]
((Quantifier) f).formula = removeImplications(((Quantifier) f).formula);

[Patch]
((Quantifier) f).formula = pushNots(((Quantifier) f).formula);

[Demonstration 3]

[Buggy Method]
public IncomingWebhookRequest deserializeAndVerify(byte[] json, String token, String attachedSignature) throws SignatureMismatchException {
    try {
        // get an hmac_sha1 key from the raw key bytes
        SecretKeySpec signingKey = new SecretKeySpec(token.getBytes(UTF8), HMAC_SHA1_ALGORITHM);
        // get an hmac_sha1 Mac instance and initialize with the signing key
        Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
        mac.init(signingKey);
        // compute the calculatedSignature on input data bytes
        byte[] rawHmac = mac.doFinal(json);
        // base64-encode the calculatedSignature
        String calculatedSignature = new BigInteger(rawHmac).toString(16);
        if (!calculatedSignature.equals(attachedSignature)) {
            throw new SignatureMismatchException("HMAC mismatch", calculatedSignature, attachedSignature);
        }
        return onfidoHttpClient.getAdapter(IncomingWebhookRequest.class).fromJson(new String(json, UTF8));
    } catch (NoSuchAlgorithmException | InvalidKeyException e) {
        throw new IllegalArgumentException(e.getMessage(), e.getCause());
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to parse json", e);
    }
}

[Buggy Hunk]
String calculatedSignature = new BigInteger(rawHmac).toString(16);

[Patch]
String calculatedSignature = new BigInteger(1, rawHmac).toString(16);