tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

fe_isnegative.c (266B)


      1 #include "fe.h"
      2 
      3 /*
      4 return 1 if f is in {1,3,5,...,q-2}
      5 return 0 if f is in {0,2,4,...,q-1}
      6 
      7 Preconditions:
      8   |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
      9 */
     10 
     11 int fe_isnegative(const fe f)
     12 {
     13  unsigned char s[32];
     14  fe_tobytes(s,f);
     15  return s[0] & 1;
     16 }