BSD 4_3 release
[unix-history] / usr / src / lib / libc / gen / crypt.c
index 09849d7..6c17b88 100644 (file)
@@ -1,4 +1,7 @@
-/* @(#)crypt.c 4.1 (Berkeley) 12/21/80 */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)crypt.c    5.2 (Berkeley) 3/9/86";
+#endif LIBC_SCCS and not lint
+
 /*
  * This program implements the
  * Proposed Federal Information Processing
 /*
  * This program implements the
  * Proposed Federal Information Processing
@@ -91,6 +94,21 @@ static       char    D[28];
  */
 static char    KS[16][48];
 
  */
 static char    KS[16][48];
 
+/*
+ * The E bit-selection table.
+ */
+static char    E[48];
+static char    e[] = {
+       32, 1, 2, 3, 4, 5,
+        4, 5, 6, 7, 8, 9,
+        8, 9,10,11,12,13,
+       12,13,14,15,16,17,
+       16,17,18,19,20,21,
+       20,21,22,23,24,25,
+       24,25,26,27,28,29,
+       28,29,30,31,32, 1,
+};
+
 /*
  * Set up the key schedule from the key.
  */
 /*
  * Set up the key schedule from the key.
  */
@@ -138,22 +156,10 @@ char *key;
                        KS[i][j+24] = D[PC2_D[j]-28-1];
                }
        }
                        KS[i][j+24] = D[PC2_D[j]-28-1];
                }
        }
-}
 
 
-/*
- * The E bit-selection table.
- */
-static char    E[48];
-static char    e[] = {
-       32, 1, 2, 3, 4, 5,
-        4, 5, 6, 7, 8, 9,
-        8, 9,10,11,12,13,
-       12,13,14,15,16,17,
-       16,17,18,19,20,21,
-       20,21,22,23,24,25,
-       24,25,26,27,28,29,
-       28,29,30,31,32, 1,
-};
+       for(i=0;i<48;i++)
+               E[i] = e[i];
+}
 
 /*
  * The 8 selection functions.
 
 /*
  * The 8 selection functions.
@@ -329,6 +335,7 @@ char *salt;
        register i, j, c;
        int temp;
        static char block[66], iobuf[16];
        register i, j, c;
        int temp;
        static char block[66], iobuf[16];
+
        for(i=0; i<66; i++)
                block[i] = 0;
        for(i=0; (c= *pw) && i<64; pw++){
        for(i=0; i<66; i++)
                block[i] = 0;
        for(i=0; (c= *pw) && i<64; pw++){
@@ -342,9 +349,6 @@ char *salt;
        for(i=0; i<66; i++)
                block[i] = 0;
 
        for(i=0; i<66; i++)
                block[i] = 0;
 
-       for(i=0;i<48;i++)
-               E[i] = e[i];
-
        for(i=0;i<2;i++){
                c = *salt++;
                iobuf[i] = c;
        for(i=0;i<2;i++){
                c = *salt++;
                iobuf[i] = c;