45 unsigned char *user_key,
46 unsigned char keysize,
57 while (mask < (
unsigned)limit)
58 mask = (mask << 1) + 1;
61 *rsum =
cards[*rsum] + user_key[(*keypos)++];
62 if (*keypos >= keysize)
68 if (++retry_limiter > 11)
71 while (u > (
unsigned)limit);
86 unsigned char toswap, swaptemp, rsum;
109 toswap =
keyrand(i, key, keysize, &rsum, &keypos);
112 cards[toswap] = swaptemp;
126 toswap = swaptemp = rsum = 0;
147 for (i=0, j=255;i<256;i++,j--)
148 cards[i] = (
unsigned char) j;
160 memset(
cards, 0, 256);
177 unsigned char swaptemp;
202 unsigned char swaptemp;
226 unsigned char hashlength)
232 for (i=0;i<hashlength;i++)
#define SWORD_NAMESPACE_START
unsigned char encrypt(unsigned char b=0)
void hash_final(unsigned char *hash, unsigned char hashlength=20)
void initialize(unsigned char *key, unsigned char keysize)
Sapphire(unsigned char *key=NULL, unsigned char keysize=0)
unsigned char last_cipher
unsigned char decrypt(unsigned char b)
unsigned char keyrand(int limit, unsigned char *user_key, unsigned char keysize, unsigned char *rsum, unsigned *keypos)
#define SWORD_NAMESPACE_END