
org.whispersystems.curve25519.java.crypto_verify_32 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of curve25519-java Show documentation
Show all versions of curve25519-java Show documentation
Curve25519 library for Java
The newest version!
package org.whispersystems.curve25519.java;
public class crypto_verify_32 {
/**
* const time equality check of x and y byte arrays of length 32
*
* @param x first byte array
* @param y second byte array
* @return 0 if equals, 1 if not
*/
public static int crypto_verify_32(byte[] x, byte[] y) {
int differentbits = 0;
for (int count = 0; count < 32; count++) {
differentbits |= (x[count] ^ y[count]);
}
return 1 ^ (1 & (((differentbits & 0xff) - 1) >> 8));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy