NIS SDES Implementation
#include
#include
typedef unsigned short int uint16 ;
typedef unsigned char uchar;
#define BIT( b, n ) ( ( b >> n ) & 0x01 )
uint16 p10( uint16 );
uint16 p8( uint16 );
uint16 p4( uint16 ) ;
uint16 ip( uint16 );
uint16 ip_inv( uint16 );
uint16 ep( uint16 );
uint16 swap( uint16 );
void print( uint16 );
void genkeys( uint16, uint16*, uint16* );
uint16 encrypt( uint16, uint16, uint16) ;
uint16 S0[4][4] =
{
{ 1, 0, 3, 2 },
{ 3, 2, 1, 0 },
{ 0, 2, 1, 3 },
{ 3, 1, 0, 3 }
};
uint16 S1[4][4] =
{
{ 0, 1, 2, 3 },
{ 2, 0, 1, 3 },
{ 3, 0, 1, 0 },
{ 2, 1, 0, 3 }
};
void dispCorrectUsage()
{
printf( "Incorrect Usage!\n" ) ;
printf( "Correct Usage is:
No comments:
Post a Comment