verify.c 339 B

123456789101112131415161718192021222324
  1. #include "crypto_verify.h"
  2. int crypto_verify(const unsigned char *x,const unsigned char *y)
  3. {
  4. unsigned int differentbits = 0;
  5. #define F(i) differentbits |= x[i] ^ y[i];
  6. F(0)
  7. F(1)
  8. F(2)
  9. F(3)
  10. F(4)
  11. F(5)
  12. F(6)
  13. F(7)
  14. F(8)
  15. F(9)
  16. F(10)
  17. F(11)
  18. F(12)
  19. F(13)
  20. F(14)
  21. F(15)
  22. return (1 & ((differentbits - 1) >> 8)) - 1;
  23. }