com.braintreegateway.util.Crypto Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.braintree-java
Show all versions of org.apache.servicemix.bundles.braintree-java
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
The newest version!
package com.braintreegateway.util;
public class Crypto {
public Boolean secureCompare(String left, String right) {
if (left == null || right == null || (left.length() != right.length())) {
return false;
}
byte[] leftBytes = left.getBytes();
byte[] rightBytes = right.getBytes();
int result = 0;
for (int i = 0; i < left.length(); i++) {
result = result | leftBytes[i] ^ rightBytes[i];
}
return result == 0;
}
}