verify.c 467 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. F(16)
  23. F(17)
  24. F(18)
  25. F(19)
  26. F(20)
  27. F(21)
  28. F(22)
  29. F(23)
  30. F(24)
  31. F(25)
  32. F(26)
  33. F(27)
  34. F(28)
  35. F(29)
  36. F(30)
  37. F(31)
  38. return (1 & ((differentbits - 1) >> 8)) - 1;
  39. }