NCBI C++ ToolKit
Defines | Functions | Variables
des.c File Reference
#include "tds.h"
#include "des.h"
+ Include dependency graph for des.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Defines

#define byteswap32(x)

Functions

 TDS_RCSID (var,"$Id: des.c 29397 2006-07-31 15:44:10Z ssikorsk $")
static void permute_ip (des_cblock inblock, DES_KEY *key, des_cblock outblock)
static void permute_fp (des_cblock inblock, DES_KEY *key, des_cblock outblock)
static void perminit_ip (DES_KEY *key)
static void spinit (DES_KEY *key)
static void perminit_fp (DES_KEY *key)
static TDS_UINT f (DES_KEY *key, register TDS_UINT r, register unsigned char *subkey)
void tds_des_set_odd_parity (des_cblock key)
static int des_init (DES_KEY *key)
int tds_des_set_key (DES_KEY *dkey, des_cblock user_key, int len)
void tds_des_encrypt (DES_KEY *key, des_cblock block)
int tds_des_ecb_encrypt (const void *plaintext, int len, DES_KEY *akey, des_cblock output)

Variables

static const char ip []
static const char fp []
static const char pc1 []
static const char totrot []
static const char pc2 []
static const char si [8][64]
static const char p32i []
static const int bytebit []
static const int nibblebit []

Define Documentation

#define byteswap32 (   x)
Value:
(TDS_UINT) (((x) & 0xff000000) >> 24 | \
                  ((x) & 0x00ff0000) >> 8 | \
                  ((x) & 0x0000ff00) << 8 | \
                  ((x) & 0x000000ff) << 24)

Definition at line 73 of file des.c.

Referenced by tds_des_encrypt().


Function Documentation

static int des_init ( DES_KEY key) [static]

Definition at line 232 of file des.c.

References perminit_fp(), perminit_ip(), and spinit().

Referenced by tds_des_set_key().

static TDS_UINT f ( DES_KEY key,
register TDS_UINT  r,
register unsigned char *  subkey 
) [static]

Definition at line 477 of file des.c.

References int, and des_key::sp.

static void perminit_fp ( DES_KEY key) [static]

Definition at line 550 of file des.c.

References bytebit, fp, des_key::fperm, and nibblebit.

Referenced by des_init().

static void perminit_ip ( DES_KEY key) [static]

Definition at line 528 of file des.c.

References bytebit, ip, des_key::iperm, and nibblebit.

Referenced by des_init().

static void permute_fp ( des_cblock  inblock,
DES_KEY key,
des_cblock  outblock 
) [static]

Definition at line 449 of file des.c.

References des_key::fperm.

Referenced by tds_des_encrypt().

static void permute_ip ( des_cblock  inblock,
DES_KEY key,
des_cblock  outblock 
) [static]

Definition at line 421 of file des.c.

References des_key::iperm.

Referenced by tds_des_encrypt().

static void spinit ( DES_KEY key) [static]

Definition at line 573 of file des.c.

References p32i, si, des_key::sp, and val.

Referenced by des_init().

int tds_des_ecb_encrypt ( const void *  plaintext,
int  len,
DES_KEY akey,
des_cblock  output 
)

Definition at line 610 of file des.c.

References tds_des_encrypt.

void tds_des_encrypt ( DES_KEY key,
des_cblock  block 
)

Definition at line 284 of file des.c.

References byteswap32, f(), des_key::kn, permute_fp(), and permute_ip().

int tds_des_set_key ( DES_KEY dkey,
des_cblock  user_key,
int  len 
)

Definition at line 245 of file des.c.

References bytebit, des_init(), des_key::kn, pc1, pc2, and totrot.

Definition at line 56 of file des.c.

TDS_RCSID ( var  ,
"$Id: des.c 29397 2006-07-31 15:44:10Z ssikorsk $"   
)

Variable Documentation

const int bytebit[] [static]
Initial value:
 {
    0200, 0100, 040, 020, 010, 04, 02, 01
}

Definition at line 220 of file des.c.

Referenced by perminit_fp(), perminit_ip(), and tds_des_set_key().

const char fp[] [static]
Initial value:
 {
    40, 8, 48, 16, 56, 24, 64, 32,
    39, 7, 47, 15, 55, 23, 63, 31,
    38, 6, 46, 14, 54, 22, 62, 30,
    37, 5, 45, 13, 53, 21, 61, 29,
    36, 4, 44, 12, 52, 20, 60, 28,
    35, 3, 43, 11, 51, 19, 59, 27,
    34, 2, 42, 10, 50, 18, 58, 26,
    33, 1, 41, 9, 49, 17, 57, 25
}

Definition at line 93 of file des.c.

Referenced by bisection(), Blast_ScoreBlkMatrixFill(), BZ2_bzclose(), bzopen_or_bzdopen(), SeqTreeAsnizer::fillAsnSeqTreeNode(), fopen_output_safely(), ir_locate(), LOG_ToFILE_Ex(), CNWAligner::MakePattern(), newtonRaphson(), perminit_fp(), PssmMaker::printAlignmentByColumn(), printMsa(), s_GetToolkitRCLogLocation(), vasprintf(), CNWAligner::x_CalcFingerPrint64(), CNWAligner::x_FindFingerPrint64(), and CDockContainer::x_GetDockPanel().

const char ip[] [static]
Initial value:
 {
    58, 50, 42, 34, 26, 18, 10, 2,
    60, 52, 44, 36, 28, 20, 12, 4,
    62, 54, 46, 38, 30, 22, 14, 6,
    64, 56, 48, 40, 32, 24, 16, 8,
    57, 49, 41, 33, 25, 17, 9, 1,
    59, 51, 43, 35, 27, 19, 11, 3,
    61, 53, 45, 37, 29, 21, 13, 5,
    63, 55, 47, 39, 31, 23, 15, 7
}

Definition at line 81 of file des.c.

Referenced by CChainer::CChainerImpl::CreateChainsForPartialProteins(), CMatrix4< T >::Determinant(), CAlignCollapser::FilterAlignments(), CChainer::CChainerImpl::FindContainedAlignments(), g_NetService_gethostbyname(), g_NetService_TryResolveHost(), CTaskServer::GetHostByIP(), CTaskServer::GetIPByHost(), CNCDistributionConf::GetMainSrvIP(), CChainer::CChainerImpl::MakeChains(), parse_server(), perminit_ip(), CMytestApplication::Run(), s_ReqStart(), CDiagContext::SetHostIP(), tds_inet_ntoa_r(), tds_open_socket(), x_ClientAddress(), and CDiagContext::x_StartRequest().

const int nibblebit[] [static]
Initial value:
 {
    010, 04, 02, 01
}

Definition at line 224 of file des.c.

Referenced by perminit_fp(), and perminit_ip().

const char p32i[] [static]
Initial value:
 {
    16, 7, 20, 21,
    29, 12, 28, 17,
    1, 15, 23, 26,
    5, 18, 31, 10,
    2, 8, 24, 14,
    32, 27, 3, 9,
    19, 13, 30, 6,
    22, 11, 4, 25
}

Definition at line 204 of file des.c.

Referenced by spinit().

const char pc1[] [static]
Initial value:
 {
    57, 49, 41, 33, 25, 17, 9,
    1, 58, 50, 42, 34, 26, 18,
    10, 2, 59, 51, 43, 35, 27,
    19, 11, 3, 60, 52, 44, 36,

    63, 55, 47, 39, 31, 23, 15,
    7, 62, 54, 46, 38, 30, 22,
    14, 6, 61, 53, 45, 37, 29,
    21, 13, 5, 28, 20, 12, 4
}

Definition at line 122 of file des.c.

Referenced by SStringLess< TComp >::operator()(), and tds_des_set_key().

const char pc2[] [static]
Initial value:
 {
    14, 17, 11, 24, 1, 5,
    3, 28, 15, 6, 21, 10,
    23, 19, 12, 4, 26, 8,
    16, 7, 27, 20, 13, 2,
    41, 52, 31, 37, 47, 55,
    30, 40, 51, 45, 33, 48,
    44, 49, 39, 56, 34, 53,
    46, 42, 50, 36, 29, 32
}

Definition at line 140 of file des.c.

Referenced by SStringLess< TComp >::operator()(), and tds_des_set_key().

const char si[8][64] [static]
const char totrot[] [static]
Initial value:
 {
    1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28
}

Definition at line 135 of file des.c.

Referenced by tds_des_set_key().

Modified on Sat Jul 12 17:04:06 2014 by modify_doxy.py rev. 426318