home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ckoetc.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  17KB  |  638 lines

  1. #ifdef TEST
  2. /*
  3.   The preliminaries and the main program are just for testing ...
  4.   Otherwise, compile and link with Kermit and everything should work.
  5.   Definitions and prototypes that might need to be shared with other
  6.   modules are in ckoetc.h.
  7. */
  8. #include <stdio.h>
  9. #ifdef sparc
  10. #define SUNOS41
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #ifdef __STDC__
  14. #define VOID void
  15. #else
  16. #define VOID int
  17. #endif /* __STDC__ */
  18. #endif /* sparc */
  19.  
  20. #ifndef NULL
  21. #define NULL 0L
  22. #endif /* NULL */
  23.  
  24. #include "ckcdeb.h"
  25.  
  26. #define DECLARE_CHK3
  27. #define _PROTOTYP( func, parms ) func parms
  28. #endif /* TEST */
  29.  
  30. /* ---(cut here for not testing, and again below)--- */
  31.  
  32. static char hexdigits[16] = {
  33.     '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
  34. };
  35.  
  36. #ifdef REXXDLL
  37. #include <stdio.h>
  38.  
  39. #ifndef NULL
  40. #define NULL 0L
  41. #endif /* NULL */
  42.  
  43. #define DECLARE_CHK3
  44. #define _PROTOTYP( func, parms ) func parms
  45. #endif /* REXXDLL */
  46.  
  47. #ifndef TEST
  48. #include "ckcdeb.h"
  49. #endif /* TEST */
  50. #include "ckuusr.h"
  51. #include "ckoetc.h"
  52. #ifdef NT
  53. #include "ckcxla.h"
  54. #include "ckuxla.h"
  55. #endif
  56.  
  57. #ifdef NT
  58. char *cketcv = "Win32 etc module 8.0.003, 8 Feb 1999";
  59. #else
  60. char *cketcv = "OS/2 etc module, 8.0.003, 8 Feb 1999";
  61. #endif /* NT */
  62. /*
  63.   Copyright (C) 1996,2004 Trustees of Columbia University in the City of New
  64.   York.  All rights reserved.
  65. */
  66.  
  67. #ifdef NOXFER
  68. #define DECLARE_CHK3
  69. #endif /* NOXFER */
  70.  
  71. #ifdef DECLARE_CHK3
  72.  
  73. static long crcta[16] = { 0L, 010201L, 020402L, 030603L, 041004L,
  74.   051205L, 061406L, 071607L, 0102010L, 0112211L, 0122412L, 0132613L, 0143014L,
  75.   0153215L, 0163416L, 0173617L };
  76.  
  77. static long crctb[16] = { 0L, 010611L, 021422L, 031233L, 043044L,
  78.   053655L, 062466L, 072277L, 0106110L, 0116701L, 0127532L, 0137323L, 0145154L,
  79.   0155745L, 0164576L, 0174367L };
  80.  
  81. unsigned int
  82. chk3(register CHAR *pkt, register int len)  {
  83.     register long c, crc;
  84.     for (crc = 0; len-- > 0; pkt++) {
  85.         c = crc ^ (long)(*pkt);
  86.         crc = (crc >> 8) ^ (crcta[(c & 0xF0) >> 4] ^ crctb[c & 0x0F]);
  87.     }
  88.     return((unsigned int) (crc & 0xFFFF));
  89. }
  90. #endif /* DECLARE_CHK3 */
  91.  
  92. /*
  93.  This is the real registration struct that will be written over
  94.  in the registration procedure.
  95. */
  96. static struct                           /* A pre-Initialized */
  97. ck_registration ck_reg = {              /* registration structure */
  98.   "====758914360207174068160528073",    /* Ident */
  99.   9999,                                    /* Recognizable strings... */
  100.   "^H^H^H^H^H^H^_{({({({(^^^^^^^^^",    /* Serial number */
  101.   "^C^C^C____^_^_^_^____)})})})})}",    /* Name */
  102.   "$(((((((((((())))))))))))^@^@^@",    /* Company */
  103.   0x5555,                               /* Dummy (and invalid) CRC */
  104.   0,                                    /* Install Time */
  105. };
  106.  
  107. static struct ck_registration reg_cpy;
  108.  
  109. static char snbuf[32]="";               /* Serial number buffer */
  110.  
  111. /*
  112.   M A K S N
  113.  
  114.   Given a numeric serial number (long), make a Kermit product serial number.
  115.   Returns a pointer to the Kermit serial number, or a null pointer if
  116.   there is any error.
  117.  
  118.   The format of the Kermit product serial number is:
  119.  
  120.     PPPPnnnnXnnYnnnVVVV
  121.  
  122.   where:
  123.  
  124.     PPPP = 4-character product ID
  125.     nnnnnnnnn = 9-digit sequential serial number (decimal)
  126.     X = final digit of decimal 16-bit CRC
  127.     Y = penultimate digit of decimal 16-bit CRC
  128.     VVVV = 4-character revision ID
  129.  
  130.   The CRC is taken on PPPPnnnnnnnnn, and starts with the magic OFFSET.
  131. */
  132. char *
  133. maksn(char * product, long n, char * revcode) { /* Make serial number */
  134.     char tmpbuf[32];
  135.     unsigned int sum = XOFFSET;
  136.     int x, y;
  137.     if (n < 1L)
  138.       return(NULL);
  139.     sprintf(tmpbuf,"%4s%09ld",product,n);
  140.     sum += chk3(tmpbuf,strlen(tmpbuf));
  141.     x = sum % 10;
  142.     y = (sum / 10) % 10;
  143.     strncpy(snbuf,tmpbuf,8);
  144.     snbuf[8] = x + '0';
  145.     snbuf[9] = tmpbuf[8];
  146.     snbuf[10] = tmpbuf[9];
  147.     snbuf[11] = y + '0';
  148.     strncpy(snbuf+12,tmpbuf+10,3);
  149.     strncpy(snbuf+15,revcode,4);
  150.     return((char *)snbuf);
  151. }
  152.  
  153. /*
  154.   C H K S N
  155.  
  156.   Given a Kermit serial number, checks to see if it is valid.
  157.   Returns a pointer to struct ck_sn, in which the ok member is
  158.   set to 0 if the serial number is not valid, and nonzero if it is valid,
  159.   with the other members set to the product code, sequential serial number,
  160.   and revision code.
  161. */
  162. static struct ck_sn sn;
  163.  
  164. struct ck_sn *
  165. chksn(char * s) {
  166.     char tmpbuf[32];
  167.     int x=0, y=0;
  168.     int sum = XOFFSET;
  169.     static struct ck_sn * p=NULL;
  170.  
  171.     p = &sn;
  172.  
  173.     memset(tmpbuf,0,32) ;
  174.     strncpy(tmpbuf,s,8);
  175.     x = s[8] - '0';
  176.     tmpbuf[8] = s[9];
  177.     tmpbuf[9] = s[10];
  178.     y = s[11] - '0';
  179.     strncpy(tmpbuf+10,s+12,3);
  180.     sum += chk3(tmpbuf,strlen(tmpbuf));
  181.     sn.ok = 0;
  182.     if (x != sum % 10) {
  183.         debug(F100,"chksn x","",0);
  184.         return(NULL);
  185.     }
  186.     if (y != (sum / 10) % 10) {
  187.         debug(F100,"chksn y","",0);
  188.         return(NULL);
  189.     }
  190.     sn.ok = 1;
  191.     strncpy(sn.product,s,3);
  192.     strncpy(sn.serial,tmpbuf+4,9);
  193.     strncpy(sn.revcode,s+16,3);
  194.  
  195.     debug(F100,"chksn z","",0);
  196.     return(p);
  197. }
  198.  
  199. /*
  200.   C K _ E N C R Y P T
  201.  
  202.   Encrypt a string in place.
  203.   If given only 7-bit ascii graphic characters, this will produce a
  204.   string that still contains only 7-bit ascii graphic characters --
  205.   no control or 8-bit characters.
  206. */
  207. VOID
  208. ck_encrypt(char * s) {
  209.     while (*s) {
  210.         if (*s != 'p' && *s != '\\' && *s != 'S')
  211.           *s ^= 0x0F;
  212.         s++;
  213.     }
  214. }
  215.  
  216. /*   C K _ D E C R Y P T  -  Decrypt a string in place */
  217.  
  218. VOID
  219. ck_decrypt(char * s) {
  220.     while (*s) {
  221.         if (*s != 'p' && *s != '\\' && *s != 'S')
  222.           *s ^= 0x0F;
  223.         s++;
  224.     }
  225. }
  226.  
  227. /*  S E T C R C  -  Puts the CRC into the registration struct.  */
  228. /* This function is called after the ck_registration structure  */
  229. /* has been encrypted. */
  230.  
  231. int
  232. setcrc(struct ck_registration * r) {
  233.     char * p;
  234.     p = malloc(94);
  235.     memset( p, 0, 94 ) ;
  236.     if (p) {
  237.        strcpy(p,r->serial);
  238.        strcpy(p+31,r->name);
  239.        strcpy(p+62,r->corp);
  240.        r->crc = chk3(p,strlen(p));
  241.        free(p);
  242.        return(1);
  243.     } else r->crc = 0;
  244.     return(0);
  245. }
  246.  
  247. /*
  248.   I S R E G I S T E R E D
  249.  
  250.   Call with pointer to a registration struct.
  251.   Returns:
  252.    0 if not set
  253.   -2 if set but crc is bad
  254.   -1 if set but serial number is invalid
  255.    >0 if set and serial number is valid and crc is good
  256.      return value is decoded serial sequence number ;
  257. */
  258.  
  259. #ifdef NT
  260.     extern CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR);  /* Character set xlate */
  261.     extern CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR);  /* functions. */
  262.     extern int tcsr, tcsl;          /* Terminal character sets, remote & local. */
  263. #endif /* NT */
  264.  
  265. char *
  266. get_reg_name(void) {
  267.     static char reg_name[32];
  268. #ifdef NT
  269.     int i;
  270.     CHAR (*cs)(CHAR) = xlr[(tcsl == TX_CP852) ? TC_2LATIN : TC_1LATIN][tx2fc(tcsl)];
  271. #endif
  272.     strncpy( reg_name, (char *) ck_reg.name, 32 ) ;
  273.     ck_decrypt( reg_name ) ;
  274. #ifdef NT
  275. #ifndef COMMENT
  276.     if (cs != NULL) {
  277.         for ( i=0;i<32;i++ )
  278.             reg_name[i] = (*cs)(reg_name[i]);
  279.     }
  280. #else
  281.     CharToOemBuff( reg_name, reg_name, 32 );
  282. #endif
  283. #endif
  284.     debug(F110,"get_reg_name",reg_name,0);
  285.     return(reg_name);
  286. }
  287. char *
  288. get_reg_corp(void) {
  289.    static char reg_corp[32] ;
  290. #ifdef NT
  291.     int i;
  292.     CHAR (*cs)(CHAR) = xlr[tcsl == TX_CP852 ? TC_2LATIN : TC_1LATIN][tx2fc(tcsl)];
  293. #endif
  294.     strncpy( reg_corp, (char *) ck_reg.corp, 32 ) ;
  295.     ck_decrypt( reg_corp ) ;
  296. #ifdef NT
  297.     if (cs != NULL) {
  298.         for ( i=0;i<32;i++ )
  299.             reg_corp[i] = (*cs)(reg_corp[i]);
  300.     }
  301. #endif
  302.     debug(F110,"get_reg_corp",reg_corp,0);
  303.     return(reg_corp);
  304. }
  305. char *
  306. get_reg_sn(void) {
  307.    static char serial[32] ;
  308. #ifdef NT
  309.     int i;
  310.     CHAR (*cs)(CHAR) = xlr[tcsl == TX_CP852 ? TC_2LATIN : TC_1LATIN][tx2fc(tcsl)];
  311. #endif
  312.     strncpy( serial, (char *) ck_reg.serial, 32 ) ;
  313.     ck_decrypt( serial ) ;
  314. #ifdef NT
  315.     if (cs != NULL) {
  316.         for ( i=0;i<32;i++ )
  317.             serial[i] = (*cs)(serial[i]);
  318.     }
  319. #endif
  320.     debug(F110,"get_reg_sn",serial,0);
  321.     return(serial);
  322. }
  323.  
  324. int
  325. get_reg_count(void) {
  326.     debug(F101,"get_reg_count","",ck_reg.is_set);
  327.     return ck_reg.is_set ;
  328. }
  329.  
  330. void
  331. reg_copy(void)
  332. {       
  333.     memcpy(®_cpy,&ck_reg,sizeof(struct ck_registration));
  334. }
  335.  
  336.  
  337.  
  338. void 
  339. regdump(char * s)
  340. {       
  341. #ifdef BETATEST
  342.     hexdump(s,&ck_reg,sizeof(struct ck_registration));
  343.     hexdump("reg_cpy",®_cpy,sizeof(struct ck_registration));
  344. #endif /* BETATEST */
  345. }
  346.  
  347. int
  348. isregistered(struct ck_registration * r) {
  349.     unsigned int crc = 0;
  350.     char * p;
  351.     struct ck_sn * sn ;
  352.     char serial[32] ;
  353.  
  354.     if (!r) r = &ck_reg;
  355.     regdump("ck_reg");
  356.     if (r->is_set == 0) {
  357.         debug(F101,"isregistered 1","",0);
  358.         return(0);
  359.     }
  360.     strncpy( serial, (char *) r->serial, 32 ) ;
  361.     ck_decrypt( serial ) ;
  362.     if (!(sn = chksn(serial))) {
  363.         debug(F101,"isregistered 2","",-1);
  364.         return(-1);
  365.     }
  366.     p = malloc(94);
  367.     memset( p, 0, 94 ) ;
  368.     if (p) {
  369.        strcpy(p,r->serial);
  370.        strcpy(p+31,r->name);
  371.        strcpy(p+62,r->corp);
  372.        crc = chk3(p,strlen(p));
  373.        free(p);
  374.     }
  375.     if (crc != r->crc) {
  376.         debug(F101,"isregistered 3","",-2);
  377.         return(-2);
  378.     }
  379.     debug(F101,"isregistered 4","",atol( sn->serial ));
  380.     return( atol( sn->serial ) );
  381. }
  382.  
  383. unsigned long
  384. regtime(struct ck_registration * r) {
  385.     if (!r) r = &ck_reg;
  386.     debug(F101,"regtime","",r->time);
  387.     return(r->time);
  388. }
  389.  
  390. #define MAXELENGTH 511
  391. unsigned char ibuf[MAXELENGTH+1];
  392. unsigned char ebuf[MAXELENGTH+MAXELENGTH+5];
  393. unsigned char dbuf[MAXELENGTH+1];
  394.  
  395. CHAR *
  396. ck_oox(s, key) char * s; char * key; {
  397.  
  398.     unsigned long left, right;
  399.     unsigned int i, k, l, n;
  400.     CHAR *p, *q;
  401.  
  402.     if (!key) key = "";
  403.     if (!s) s = "";
  404.  
  405.     if ((k = (int)strlen(s)) > MAXELENGTH)
  406.       return((CHAR *)"");
  407.  
  408.     memset(ibuf,'\0',MAXELENGTH+1);     /* 0-padded source buffer */
  409.     memset(ebuf,'\0',MAXELENGTH+MAXELENGTH+5); /* Clear destination buffer */
  410.     InitializeBlowfish((CHAR *)key, (short)strlen(key));
  411.     strncpy(ibuf,(CHAR *)s,MAXELENGTH); /* Copy source to padded cell */
  412.     p = ibuf;                           /* Point to padded source string */
  413.     n = k / 8;                          /* Number of 64-bit blocks */
  414.     if (k % 8) n++;                     /* Including possibly padded last */
  415.     q = ebuf;                           /* Pointer to destination buffer */
  416.     for (l = 0; l < n; l++) {           /* Loop for each block */
  417.         left = right = 0;               /* Init to all 0's */
  418. #ifdef COMMENT
  419.         memcpy((CHAR *)&left,  p,   4);
  420.         memcpy((CHAR *)&right, p+4, 4);
  421. #else
  422.         left  = *p + (*(p+1)<<8) + (*(p+2)<<16) + (*(p+3)<<24);
  423.         right = *(p+4) + (*(p+5)<<8) + (*(p+6)<<16) + (*(p+7)<<24);
  424. #endif
  425.         Blowfish_encipher(&left, &right); /* Output in hex because  */
  426.  
  427.  
  428.         for (i = 0; i < 8; i++) {         /* it might contain zeros */
  429.             *(q+i)   = hexdigits[(left  >> (4 * (7 - i))) & 0x0f];
  430.             *(q+i+8) = hexdigits[(right >> (4 * (7 - i))) & 0x0f];
  431.         }
  432.         p += 8;
  433.         q += 16;
  434.     }
  435.     return ((CHAR *) ebuf);
  436. }
  437.  
  438.  
  439. #ifdef REXXDLL
  440. #define  INCL_REXXSAA
  441. #include <rexxsaa.h>
  442. ULONG APIENTRY
  443. RexxValidateSN(
  444.     PUCHAR Name,
  445.     ULONG Argc,
  446.     PRXSTRING Argv,
  447.     PSZ Queuename,
  448.     PRXSTRING Retstr) {
  449.     int rc = 0 ;
  450.     int i ;
  451.  
  452.     if ( Argc != 1 || RXZEROLENSTRING(Argv[0])) {
  453.         MAKERXSTRING( *Retstr, strdup(""), 0 ) ;
  454.         return -1;
  455.     }
  456.     if ( chksn( RXSTRPTR(Argv[0])) ) {
  457.         MAKERXSTRING( *Retstr, strdup("1"), 1 ) ;
  458.     } else {
  459.         MAKERXSTRING( *Retstr, strdup("0"), 1 ) ;
  460.     }
  461.     return 0 ;
  462. }
  463. #endif /* REXXDLL */
  464.  
  465. /* ---(cut here for not testing, to end)--- */
  466.  
  467. #ifdef TEST
  468. static struct                           /* Test */
  469. ck_registration ck_reg2 = {             /* A good registration structure */
  470.   "====758914360207174068160528073",    /* Ident */
  471.   1,                                    /* Has been set */
  472.   "K95-00000000000-1.1            ",    /* Invalid serial number */
  473.   "Fred J. Dobbs                  ",
  474.   "Rio Grande Mining Company      ",
  475.   0
  476. };
  477.  
  478. static struct                           /* Test */
  479. ck_registration ck_reg3 = {             /* A bad registration structure */
  480.   "====758914360207174068160528073",    /* Ident */
  481.   1,                                    /* Has been set */
  482.   "K95-13240563789-1.1            ",    /* Invalid serial number */
  483.   "Fred J. Dobbs                  ",
  484.   "Rio Grande Mining Company      ",
  485.   0
  486. };
  487.  
  488. static struct                           /* Test */
  489. ck_registration ck_reg4 = {             /* A good registration structure */
  490.   "====758914360207174068160528073",    /* Ident */
  491.   1,                                    /* Has been set */
  492.   "K95-12345567789-1.1            ",    /* Valid serial number */
  493.   "Bill Clinton                   ",
  494.   "USA, Inc.                      ",
  495.   666                                   /* Bad CRC */
  496. };
  497.  
  498. static struct                           /* Test */
  499. ck_registration ck_reg5 = {             /* A good registration structure */
  500.   "====758914360207174068160528073",    /* Ident */
  501.   1,                                    /* Has been set */
  502.   "K95-12345567789-1.1            ",    /* Valid serial number */
  503.   "Bill Gates                     ",
  504.   "Microsoft Corporation          ",
  505.   0                                     /* Dummy CRC */
  506. };
  507.  
  508. struct kuid {
  509.     unsigned char * user;
  510.     unsigned char * password;
  511. };
  512.  
  513. struct kuid uids[] = {
  514.     "BLOWFISH", "abcdefghijklmnopqrstuvwxyz",
  515.     "BLOWFISH", "abcdefghijklmnopqrstuvwxyz",
  516.     "BLOWFISH", "Who is John Galt?",
  517.     "BLOWFISH", "Who is John Galt?",
  518.     "BLOWFISH", "Who is John Galt?",
  519.     "abc", "xyz",
  520.     "abc", "xyz",
  521.     "abc", "xyz",
  522.     "abc", "xyz",
  523.     "12345678", "12345678",
  524.     "12345678", "12345678",
  525.     "longername", "longerpassword",
  526.     "longername", "longerpassword",
  527.     "longername", "longerpassword",
  528.     "veryveryverylongname", "",
  529.     "veryveryverylongname", "",
  530.     "four", "eightxxx",
  531.     "four", "eightxxx"
  532. };
  533. int nuids = (sizeof(uids) / sizeof(struct kuid));
  534.  
  535. char unsigned *
  536. oodecrypt(s, key, k) unsigned char *s; unsigned char *key; int k; {
  537.     unsigned long left, right;
  538.     unsigned int i, j, l, n, x;
  539.     unsigned char *p, *q, c1, c2;
  540.  
  541.     n = k / 8;                          /* Number of blocks */
  542.     if (k % 8) n++;
  543.  
  544.     memset(dbuf,'\0',MAXELENGTH+1);     /* Destination buffer */
  545.     q = dbuf;                           /* and pointer */
  546.  
  547.     p = s;                              /* Source pointer */
  548.  
  549.     for (l = 0; l < n; l++) {           /* Loop thru each block */
  550.         left = right = 0;
  551.         sscanf(p,"%8x",&left);
  552.         sscanf(p+8,"%8x",&right);
  553.         Blowfish_decipher(&left, &right);
  554. #ifdef COMMENT
  555.         memcpy(q,  (unsigned char *)&left,4);
  556.         memcpy(q+4,(unsigned char *)&right,4);
  557. #else
  558.         *q = left&0xFF;
  559.         *(q+1) = (left>>8)&0xFF;
  560.         *(q+2) = (left>>16)&0xFF;
  561.         *(q+3) = (left>>24)&0xFF;
  562.         *(q+4) = right&0xFF;
  563.         *(q+5) = (right>>8)&0xFF;
  564.         *(q+6) = (right>>16)&0xFF;
  565.         *(q+7) = (right>>24)&0xFF;
  566. #endif
  567.         q += 8;
  568.         p += 16;
  569.     }
  570.     return((unsigned char *)dbuf);
  571. }
  572.  
  573. VOID
  574. main(int argc, char ** argv) {
  575.  
  576.     unsigned int i, j, k, n;
  577.     unsigned char *q;
  578.  
  579.     long xx;
  580.     int x;
  581.     char * p;
  582.  
  583.     char astring[] = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !@#$%^&*()_-=+[]\\{};:'\",<.>/?" ;
  584.     char bstring[98];
  585.  
  586.     struct ck_sn * sp;
  587.  
  588.     if (argc < 2)
  589.       xx = 123456789L;
  590.     else
  591.       xx = atol(argv[1]);
  592.     p = maksn(PRODUCT,xx,REVCODE);
  593.     printf("%s\n",p);
  594.     sp = chksn(p);
  595.  
  596.     printf("ok = %d\n",sp->ok);
  597.     printf("product=\"%s\"\n",sp->product);
  598.     printf("serial =\"%s\"\n",sp->serial);
  599.     printf("revcode=\"%s\"\n",sp->revcode);
  600.  
  601.     strcpy(bstring,astring);
  602.     printf("String    = \"%s\"\n",astring);
  603.     ck_encrypt(astring);
  604.     printf("Encrypted = \"%s\"\n",astring);
  605.     ck_decrypt(astring);
  606.     printf("Decrypted = \"%s\"\n",astring);
  607.     if (!strcmp(astring,bstring))
  608.       printf("Decryption OK\n");
  609.     else
  610.       printf("Decryption failed\n");
  611.     x = isregistered(&ck_reg);
  612.     printf("isregistered 1: %d\n",x);
  613.     x = isregistered(&ck_reg2);
  614.     printf("isregistered 2: %d\n",x);
  615.     x = isregistered(&ck_reg3);
  616.     printf("isregistered 3: %d\n",x);
  617.     x = isregistered(&ck_reg4);
  618.     printf("isregistered 4: %d\n",x);
  619.     x = setcrc(&ck_reg5);
  620.     x = isregistered(&ck_reg5);
  621.     printf("isregistered 5: %d\n",x);
  622.  
  623.     for (i = 0; i < nuids; i++) {
  624.         n = strlen(uids[i].user);
  625.         printf("%s_%s\n",uids[i].user,uids[i].password);
  626.         q = ck_oox(uids[i].user,uids[i].password);
  627.         printf("encrypted=[%s]\n",q);
  628. /*
  629.         for (j = 0; j < n; j++)
  630.           printf("%02x",(unsigned int) q[j]);
  631.         printf("]\n");
  632. */
  633.         q = oodecrypt(q,uids[i].password,n);
  634.         printf("decrypted=[%s]\n",q);
  635.     }
  636. }
  637. #endif /* TEST */
  638.