This is checker.c in view mode; [Download] [Up]
#import "ben.h"
int checkEncrypt( char *serial, double *e, char *t, double *n, char *key)
{
int r;
int r1, r23;
int r9;
char *tp;
double tmp1, tmp2;
int b1, b2, b3, b4,b5,b6,b7,b8;
int salty1, salty2;
char buf3[10], buf4[10];
// printf("checking key <%s> for serial <%s>\n", key, serial);
r1 = 13;
r23 = 7;
for( r= 0; r < 10 ; r ++ )
{
r1 = (r1 + serial[r] * r) % 50;
r23 = (r23 * serial[r]) % (50 * 50);
}
r1 = r1 % 50;
r23 = r23 % (50*50);
r9 = modulus( key[KEY_SIMP1] ^ key[KEY_SIMP2] ^ key[KEY_SIMP3] ^
key[KEY_BUF1] ^ key[KEY_BUF2] ^
key[KEY_BUF3] ^ key[KEY_BUF4] ^
key[KEY_SALT1] ^ key[KEY_SALT2] , 50);
if( key[KEY_SIMP1] != t[r1] )
return KEY_SIMP1 + 100;
if( key[KEY_SIMP2] != t[ r23 / 50] )
return KEY_SIMP2 + 100;
if( key[KEY_SIMP3] != t[ r23 % 50] )
return KEY_SIMP3 + 100;
if( key[KEY_CHECK] != t[r9] )
return KEY_CHECK + 100;
tp = index( t, key[KEY_SALT1] );
if( tp == NULL )
return KEY_SALT1 + 100;
salty1 = tp - t;
tp = index( t, key[KEY_SALT2] );
if( tp == NULL )
return KEY_SALT2 + 100;
salty2 = tp - t;
if( key[KEY_SALT1] != t[salty1] )
return KEY_SALT1 + 100;
if( key[KEY_SALT2] != t[salty2] )
return KEY_SALT2;
// printf( "Test: salt1 = %d salt2 = %d\n", salty1, salty2);
strncpy( buf3, serial, 5);
strncpy( buf4, serial+5, 5);
buf3[5] = buf4[5] = '\0';
tmp1 = atoi( buf3);
tmp2 = atoi( buf4);
tmp1 = tmp1 + salty1;
tmp2 = tmp2 + salty2;
// printf( "Test: tmp1 = %g tmp2 = %g\n", tmp1, tmp2);
// printf( "Test: buf3 = %s buf4 = %s\n", buf3, buf4);
tmp1= ben( tmp1, *e, *n);
tmp2= ben( tmp2, *e, *n);
b1 = tmp1 / 125000;
b2 = (tmp1 - (b1 * 125000)) / 2500;
b3 = (tmp1 - (b1 * 125000) - (b2 * 2500)) / 50;
b4 = modulus( tmp1, 50);
b1 = modulus( b1, 50);
b2 = modulus( b2, 50);
b3 = modulus( b3, 50);
b5 = tmp2 / 125000;
b6 = (tmp2 - (b5 * 125000)) / 2500;
b7 = (tmp2 - (b5 * 125000) - (b6 * 2500)) / 50;
b8 = modulus( tmp2, 50);
b5 = modulus( b5, 50);
b6 = modulus( b6, 50);
b7 = modulus( b7, 50);
buf3[0] = t[(int) modulus((b1 ^ b5), 50 )];
buf3[1] = t[(int) modulus((b2 ^ b6), 50 )];
buf3[2] = t[(int) modulus((b3 ^ b7), 50 )];
buf3[3] = t[(int) modulus((b4 ^ b8), 50 )];
buf3[4] = '\0';
// printf("%c vs %c \n", key[KEY_BUF1], buf3[0] );
if( key[KEY_BUF1] != buf3[0] )
return KEY_BUF1 + 100;
if( key[KEY_BUF2] != buf3[1] )
return KEY_BUF2 + 100;
if( key[KEY_BUF3] != buf3[2] )
return KEY_BUF3 + 100;
if( key[KEY_BUF4] != buf3[3] )
return KEY_BUF4 + 100;
return 0;
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.