Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Defines | Functions
crypt.h File Reference
#include "scconfig.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CRC32(c, b)   ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
#define zdecode(pkeys, pcrc_32_tab, c)   (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys, pcrc_32_tab, c, t)   (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))

Functions

static int decrypt_byte (unsigned long *pkeys, const unsigned long *pcrc_32_tab)
static int update_keys (unsigned long *pkeys, const unsigned long *pcrc_32_tab, int c)
static void init_keys (const char *passwd, unsigned long *pkeys, const unsigned long *pcrc_32_tab)

Define Documentation

#define CRC32 (   c,
 
)    ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))

Definition at line 38 of file crypt.h.

#define zdecode (   pkeys,
  pcrc_32_tab,
 
)    (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))

Definition at line 84 of file crypt.h.

#define zencode (   pkeys,
  pcrc_32_tab,
  c,
 
)    (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))

Definition at line 87 of file crypt.h.


Function Documentation

static int decrypt_byte ( unsigned long pkeys,
const unsigned long pcrc_32_tab 
) [static]

Definition at line 43 of file crypt.h.

{
    unsigned temp;  /* POTENTIAL BUG:  temp*(temp^1) may overflow in an
                     * unpredictable manner on 16-bit systems; not a problem
                     * with any known compiler so far, though */

    temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
    return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
static void init_keys ( const char *  passwd,
unsigned long pkeys,
const unsigned long pcrc_32_tab 
) [static]

Definition at line 73 of file crypt.h.

{
    *(pkeys+0) = 305419896L;
    *(pkeys+1) = 591751049L;
    *(pkeys+2) = 878082192L;
    while (*passwd != '\0') {
        update_keys(pkeys,pcrc_32_tab,(int)*passwd);
        passwd++;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int update_keys ( unsigned long pkeys,
const unsigned long pcrc_32_tab,
int  c 
) [static]

Definition at line 56 of file crypt.h.

{
    (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
    (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
    (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
    {
      register int keyshift = (int)((*(pkeys+1)) >> 24);
      (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
    }
    return c;
}

Here is the call graph for this function:

Here is the caller graph for this function: