Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

Tausworthe.cxx File Reference

#include <string.h>
#include "abkrand.h"
#include "abkMD5.h"

Include dependency graph for Tausworthe.cxx:

Include dependency graph

Go to the source code of this file.

Functions

void numToStr (char *str, unsigned num)
unsigned trim (unsigned arg)
unsigned addMod (unsigned x, unsigned y)
unsigned times5 (unsigned x)
unsigned timesTwoTo16 (unsigned x)

Variables

const unsigned cryptMod = 0xfffffffb
const unsigned initVector = 0xa90acaf7
const unsigned twoTo16 = 0x10000
const unsigned twoTo31 = 0x80000000
const char padding []


Function Documentation

unsigned addMod unsigned  x,
unsigned  y
 

Definition at line 97 of file Tausworthe.cxx.

References trim(), and twoTo31.

Referenced by Tausworthe::_multmod(), times5(), and timesTwoTo16().

00098 {
00099     bool bigX=false,bigY=false;
00100     unsigned retval;
00101     if (x>=twoTo31) {x-=twoTo31;bigX=true;}
00102     if (y>=twoTo31) {y-=twoTo31;bigY=true;}
00103     if (bigX&&bigY)
00104     {
00105         retval = trim(trim(x+y)+5) ;//mod 2^32-5
00106     }
00107     else if (bigX||bigY)
00108     {
00109         if ((x+y)<twoTo31)
00110             retval = trim(x+y+twoTo31);
00111         else
00112             retval = trim(((x+y)-twoTo31)+5);
00113     }
00114     else
00115         retval = trim(x+y);
00116     return retval;
00117 }

Here is the call graph for this function:

void numToStr char *  str,
unsigned  num
[static]
 

Definition at line 58 of file Tausworthe.cxx.

Referenced by Tausworthe::_encryptBufMultipartiteSeed().

00059     {
00060     str[0] = (num & 0xf) +1;
00061     num >>= 4;
00062     str[1] = (num & 0xf) +1;
00063     num >>= 4;
00064     str[2] = (num & 0xf) +1;
00065     num >>= 4;
00066     str[3] = (num & 0xf) +1;
00067     num >>= 4;
00068     str[4] = (num & 0xf) +1;
00069     num >>= 4;
00070     str[5] = (num & 0xf) +1;
00071     num >>= 4;
00072     str[6] = (num & 0xf) +1;
00073     num >>= 4;
00074     str[7] = (num & 0xf) +1;
00075     }

unsigned times5 unsigned  x  ) 
 

Definition at line 119 of file Tausworthe.cxx.

References addMod().

Referenced by Tausworthe::_multmod().

00120 {
00121     unsigned x2=addMod(x,x);
00122     unsigned x4=addMod(x2,x2);
00123     return addMod(x,x4);
00124     /*
00125     unsigned lowerX = x &  0x0000ffff;
00126     unsigned upperX = x >> 16;
00127     unsigned upTimes5=upperX*5; //can't overflow or exceed cryptMod
00128     unsigned upTerm;
00129     if (upTimes5>=twoTo16)
00130         upTerm=(upTimes5-twoTo16)*twoTo16+5; //can't overflow or exceed cryptMod
00131     else
00132         upTerm=upTimes5*twoTo16; // can't overflow or exceed cryptMod
00133     unsigned lowTerm=lowerX*5; //can't overflow or exceed cryptMod
00134     return addMod(upTerm,lowTerm);
00135     */
00136 }

Here is the call graph for this function:

unsigned timesTwoTo16 unsigned  x  ) 
 

Definition at line 138 of file Tausworthe.cxx.

References addMod(), and twoTo16.

Referenced by Tausworthe::_multmod().

00139 {
00140     unsigned lowerX = x &  0x0000ffff;
00141     unsigned upperX = x >> 16;
00142     unsigned upTerm=upperX*5;
00143     unsigned lowTerm=lowerX*twoTo16;
00144 
00145     return addMod(upTerm,lowTerm);
00146 }

Here is the call graph for this function:

unsigned trim unsigned  arg  )  [inline]
 

Definition at line 93 of file Tausworthe.cxx.

References cryptMod.

Referenced by Tausworthe::_multmod(), and addMod().

00094 { return (arg>=cryptMod)?(arg-cryptMod):arg;}


Variable Documentation

const unsigned cryptMod = 0xfffffffb [static]
 

Definition at line 48 of file Tausworthe.cxx.

Referenced by trim().

const unsigned initVector = 0xa90acaf7 [static]
 

Definition at line 49 of file Tausworthe.cxx.

Referenced by Tausworthe::_encryptBufWithSeed().

const char padding[] [static]
 

Initial value:

"I am I, Don Quixote, the Lord of La Mancha, my "
                      "destiny calls and I go.  And the wild winds of "
                      "fortune shall carry me onwards, o whithersoever "
                      "they blow"

Definition at line 53 of file Tausworthe.cxx.

Referenced by Tausworthe::_encryptBufMultipartiteSeed().

const unsigned twoTo16 = 0x10000 [static]
 

Definition at line 50 of file Tausworthe.cxx.

Referenced by timesTwoTo16().

const unsigned twoTo31 = 0x80000000 [static]
 

Definition at line 51 of file Tausworthe.cxx.

Referenced by addMod().


Generated on Mon Apr 25 01:12:38 2005 for Parquete by doxygen 1.3.2