2
0

ocb_ntz.c 571 B

1234567891011121314151617181920212223242526272829
  1. /* LibTomCrypt, modular cryptographic library -- Tom St Denis
  2. *
  3. * LibTomCrypt is a library that provides various cryptographic
  4. * algorithms in a highly modular and flexible manner.
  5. *
  6. * The library is free for all purposes without any express
  7. * guarantee it works.
  8. *
  9. * Tom St Denis, [email protected], http://libtomcrypt.org
  10. */
  11. /* OCB Implementation by Tom St Denis */
  12. #include "mycrypt.h"
  13. #ifdef OCB_MODE
  14. int ocb_ntz(unsigned long x)
  15. {
  16. int c;
  17. x &= 0xFFFFFFFFUL;
  18. c = 0;
  19. while ((x & 1) == 0) {
  20. ++c;
  21. x >>= 1;
  22. }
  23. return c;
  24. }
  25. #endif