[BACK]Return to bdes.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / bdes

Diff for /src/usr.bin/bdes/Attic/bdes.c between version 1.10 and 1.11

version 1.10, 2003/06/03 02:56:06 version 1.11, 2003/06/10 22:20:45
Line 181 
Line 181 
   
   
 int  int
 main(ac, av)  main(int ac, char *av[])
         int ac;                         /* arg count */  
         char **av;                      /* arg vector */  
 {  {
         extern int optind;              /* option (argument) number */          extern int optind;              /* option (argument) number */
         extern char *optarg;            /* argument to option if any */          extern char *optarg;            /* argument to option if any */
Line 357 
Line 355 
  * map a hex character to an integer   * map a hex character to an integer
  */   */
 int  int
 tobinhex(c, radix)  tobinhex(char c, int radix)
         char c;                 /* char to be converted */  
         int radix;              /* base (2 to 16) */  
 {  {
         switch(c) {          switch(c) {
         case '0':               return(0x0);          case '0':               return(0x0);
Line 389 
Line 385 
  * convert the key to a bit pattern   * convert the key to a bit pattern
  */   */
 void  void
 cvtkey(obuf, ibuf)  cvtkey(char *obuf, char *ibuf)
         char *obuf;                     /* bit pattern */  
         char *ibuf;                     /* the key itself */  
 {  {
         int i, j;                       /* counter in a for loop */          int i, j;                       /* counter in a for loop */
         int nbuf[64];                   /* used for hex/key translation */          int nbuf[64];                   /* used for hex/key translation */
Line 458 
Line 452 
  * 3. must be a multiple of mult   * 3. must be a multiple of mult
  */   */
 int  int
 setbits(s, mult)  setbits(char *s, int mult)
         char *s;                        /* the ASCII string */  
         int mult;                       /* what it must be a multiple of */  
 {  {
         char *p;                        /* pointer in a for loop */          char *p;                        /* pointer in a for loop */
         int n = 0;                      /* the integer collected */          int n = 0;                      /* the integer collected */
Line 501 
Line 493 
  * DES ignores the low order bit of each character.   * DES ignores the low order bit of each character.
  */   */
 void  void
 makekey(buf)  makekey(Desbuf buf)
         Desbuf buf;                             /* key block */  
 {  {
         int i, j;                               /* counter in a for loop */          int i, j;                               /* counter in a for loop */
         int par;                                /* parity counter */          int par;                                /* parity counter */
Line 530 
Line 521 
  * This encrypts using the Electronic Code Book mode of DES   * This encrypts using the Electronic Code Book mode of DES
  */   */
 void  void
 ecbenc()  ecbenc(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int bn;                 /* block number */          int bn;                 /* block number */
Line 559 
Line 550 
  * This decrypts using the Electronic Code Book mode of DES   * This decrypts using the Electronic Code Book mode of DES
  */   */
 void  void
 ecbdec()  ecbdec(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int c;                  /* used to test for EOF */          int c;                  /* used to test for EOF */
Line 591 
Line 582 
  * This encrypts using the Cipher Block Chaining mode of DES   * This encrypts using the Cipher Block Chaining mode of DES
  */   */
 void  void
 cbcenc()  cbcenc(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int bn;                 /* block number */          int bn;                 /* block number */
Line 625 
Line 616 
  * This decrypts using the Cipher Block Chaining mode of DES   * This decrypts using the Cipher Block Chaining mode of DES
  */   */
 void  void
 cbcdec()  cbcdec(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         Desbuf msgbuf;          /* I/O buffer */          Desbuf msgbuf;          /* I/O buffer */
Line 662 
Line 653 
  * This authenticates using the Cipher Block Chaining mode of DES   * This authenticates using the Cipher Block Chaining mode of DES
  */   */
 void  void
 cbcauth()  cbcauth(void)
 {  {
         int n, j;               /* number of bytes actually read */          int n, j;               /* number of bytes actually read */
         Desbuf msgbuf;          /* I/O buffer */          Desbuf msgbuf;          /* I/O buffer */
Line 707 
Line 698 
  * This encrypts using the Cipher FeedBack mode of DES   * This encrypts using the Cipher FeedBack mode of DES
  */   */
 void  void
 cfbenc()  cfbenc(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int nbytes;             /* number of bytes to read */          int nbytes;             /* number of bytes to read */
Line 749 
Line 740 
  * This decrypts using the Cipher Block Chaining mode of DES   * This decrypts using the Cipher Block Chaining mode of DES
  */   */
 void  void
 cfbdec()  cfbdec(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int c;                  /* used to test for EOF */          int c;                  /* used to test for EOF */
Line 795 
Line 786 
  * This encrypts using the alternative Cipher FeedBack mode of DES   * This encrypts using the alternative Cipher FeedBack mode of DES
  */   */
 void  void
 cfbaenc()  cfbaenc(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int nbytes;             /* number of bytes to read */          int nbytes;             /* number of bytes to read */
Line 841 
Line 832 
  * This decrypts using the alternative Cipher Block Chaining mode of DES   * This decrypts using the alternative Cipher Block Chaining mode of DES
  */   */
 void  void
 cfbadec()  cfbadec(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int c;                  /* used to test for EOF */          int c;                  /* used to test for EOF */
Line 888 
Line 879 
  * This encrypts using the Output FeedBack mode of DES   * This encrypts using the Output FeedBack mode of DES
  */   */
 void  void
 ofbenc()  ofbenc(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int c;                  /* used to test for EOF */          int c;                  /* used to test for EOF */
Line 934 
Line 925 
  * This decrypts using the Output Block Chaining mode of DES   * This decrypts using the Output Block Chaining mode of DES
  */   */
 void  void
 ofbdec()  ofbdec(void)
 {  {
         int n;                  /* number of bytes actually read */          int n;                  /* number of bytes actually read */
         int c;                  /* used to test for EOF */          int c;                  /* used to test for EOF */
Line 983 
Line 974 
  * This authenticates using the Cipher FeedBack mode of DES   * This authenticates using the Cipher FeedBack mode of DES
  */   */
 void  void
 cfbauth()  cfbauth(void)
 {  {
         int n, j;               /* number of bytes actually read */          int n, j;               /* number of bytes actually read */
         int nbytes;             /* number of bytes to read */          int nbytes;             /* number of bytes to read */
Line 1066 
Line 1057 
  * message about usage   * message about usage
  */   */
 void  void
 usage()  usage(void)
 {  {
         (void)fprintf(stderr, "%s\n",          (void)fprintf(stderr, "%s\n",
 "usage: bdes [-abdp] [-F bit] [-f bit] [-k key] [-m bit] [-o bit] [-v vector]");  "usage: bdes [-abdp] [-F bit] [-f bit] [-k key] [-m bit] [-o bit] [-v vector]");

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11