home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
ODR.ARJ
/
ODR.C
next >
Wrap
C/C++ Source or Header
|
1996-06-14
|
1KB
|
52 lines
#include <stdio.h>
#include <string.h>
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
WORD GenKey( BYTE *Buf )
{
WORD nLen, Sum, Flag, i;
i = 0;
Sum = 0;
while( Buf[ i ] ){
Sum += Buf[ i ] * ( ( i & 0x7 ) + 1 );
i ++;
}
Flag = 0;
Flag |= ( Sum & 0x0001 ) << 0xf;
Flag |= ( Sum & 0x0002 ) << 0xd;
Flag |= ( Sum & 0x0004 ) << 0xb;
Flag |= ( Sum & 0x0008 );
Flag |= ( Sum & 0x0010 ) >> 0x2;
Flag |= ( Sum & 0x0020 ) << 0x3;
Flag |= ( Sum & 0x0040 ) >> 0x1;
Flag |= ( Sum & 0x0080 ) << 0x4;
Flag |= ( Sum & 0x0100 ) >> 0x8;
Flag |= ( Sum & 0x0200 ) << 0x3;
Flag |= ( Sum & 0x0400 ) >> 0x9;
Flag |= ( Sum & 0x0800 ) >> 0x2;
Flag |= ( Sum & 0x1000 ) >> 0x5;
Flag |= ( Sum & 0x2000 ) >> 0x9;
Flag |= ( Sum & 0x4000 ) >> 0x8;
Flag |= ( Sum & 0x8000 ) >> 0x5;
return Flag;
}
void main( void )
{
BYTE bName[ 128 ], i;
printf( "ODR --- OpenDoor Register\n" );
printf( "Enter you Name: " );
gets( bName );
printf( "Your Register Key is: %04X.\n", GenKey( bName ) );
}