/** * Compare this Rainbow private key with another object. * * @param other the other object * @return the result of the comparison */ public boolean equals(Object other) { if (other == null || !(other instanceof BCRainbowPrivateKey)) { return false; } BCRainbowPrivateKey otherKey = (BCRainbowPrivateKey)other; boolean eq = true; // compare using shortcut rule ( && instead of &) eq = eq && RainbowUtil.equals(A1inv, otherKey.getInvA1()); eq = eq && RainbowUtil.equals(A2inv, otherKey.getInvA2()); eq = eq && RainbowUtil.equals(b1, otherKey.getB1()); eq = eq && RainbowUtil.equals(b2, otherKey.getB2()); eq = eq && Arrays.equals(vi, otherKey.getVi()); if (layers.length != otherKey.getLayers().length) { return false; } for (int i = layers.length - 1; i >= 0; i--) { eq &= layers[i].equals(otherKey.getLayers()[i]); } return eq; }