Defines | Enumerations

SecurityDefines.hpp File Reference

Go to the source code of this file.

Defines

#define SHFR(x, n)   (x >> n)
#define ROTR(x, n)   ((x >> n) | (x << ((sizeof(x) << 3) - n)))
#define ROTL(x, n)   ((x << n) | (x >> ((sizeof(x) << 3) - n)))
#define CH(x, y, z)   ((x & y) ^ (~x & z))
#define MAJ(x, y, z)   ((x & y) ^ (x & z) ^ (y & z))
#define PACK32(str, x)
#define UNPACK32(x, str)
#define PACK64(str, x)
#define UNPACK64(x, str)
#define HOST_c2l(c, l)
#define HOST_l2c(l, c)
#define SWAP(n)   (n)

Enumerations

enum  ECryptType { etSimpleDES = 0, etXTEA = 1 }

Define Documentation

#define CH (   x,
  y,
 
)    ((x & y) ^ (~x & z))
#define HOST_c2l (   c,
 
)
Value:
(\
           l =(((unsigned long)(*((c)++)))<<24), \
           l|=(((unsigned long)(*((c)++)))<<16), \
           l|=(((unsigned long)(*((c)++)))<< 8), \
           l|=(((unsigned long)(*((c)++)))    ), \
           l)
#define HOST_l2c (   l,
 
)
Value:
(\
           *((c)++)=(unsigned char)(((l)>>24)&0xff), \
           *((c)++)=(unsigned char)(((l)>>16)&0xff), \
           *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
           *((c)++)=(unsigned char)(((l)    )&0xff), \
           l)
#define MAJ (   x,
  y,
 
)    ((x & y) ^ (x & z) ^ (y & z))
#define PACK32 (   str,
 
)
Value:
{                                         \
    *(x) = ((Uint32) *((str) + 3))        | \
           ((Uint32) *((str) + 2) <<  8)  | \
           ((Uint32) *((str) + 1) << 16)  | \
           ((Uint32) *((str) + 0) << 24);   \
  }
#define PACK64 (   str,
 
)
Value:
{                                          \
    *(x) = ((Uint64) *((str) + 7)      )  |  \
           ((Uint64) *((str) + 6) <<  8)  |  \
           ((Uint64) *((str) + 5) << 16)  |  \
           ((Uint64) *((str) + 4) << 24)  |  \
           ((Uint64) *((str) + 3) << 32)  |  \
           ((Uint64) *((str) + 2) << 40)  |  \
           ((Uint64) *((str) + 1) << 48)  |  \
           ((Uint64) *((str) + 0) << 56);    \
  }
#define ROTL (   x,
 
)    ((x << n) | (x >> ((sizeof(x) << 3) - n)))
#define ROTR (   x,
 
)    ((x >> n) | (x << ((sizeof(x) << 3) - n)))
#define SHFR (   x,
 
)    (x >> n)
#define SWAP (   n )    (n)
#define UNPACK32 (   x,
  str 
)
Value:
{                                      \
    *((str) + 3) = (Uint8) ((x));        \
    *((str) + 2) = (Uint8) ((x) >>  8);  \
    *((str) + 1) = (Uint8) ((x) >> 16);  \
    *((str) + 0) = (Uint8) ((x) >> 24);  \
  }
#define UNPACK64 (   x,
  str 
)
Value:
{                                         \
    *((str) + 7) = (Uint8) ((x));           \
    *((str) + 6) = (Uint8) ((x) >>  8);     \
    *((str) + 5) = (Uint8) ((x) >> 16);     \
    *((str) + 4) = (Uint8) ((x) >> 24);     \
    *((str) + 3) = (Uint8) ((x) >> 32);     \
    *((str) + 2) = (Uint8) ((x) >> 40);     \
    *((str) + 1) = (Uint8) ((x) >> 48);     \
    *((str) + 0) = (Uint8) ((x) >> 56);     \
  }

Enumeration Type Documentation

enum ECryptType

this enumeration will select the correct symetric crypt algorithm

Enumerator:
etSimpleDES 
etXTEA 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:21