]> andersk Git - moira.git/blob - lib/idno.c
be166df2ba7279e9fb416117ab6ed351eae6a33b
[moira.git] / lib / idno.c
1 /* $Header$
2  *
3  * Routines to encrypt ID's
4  *
5  *  (c) Copyright 1988 by the Massachusetts Institute of Technology.
6  *  For copying and distribution information, please see the file
7  *  <mit-copyright.h>.
8  */
9
10 #include <mit-copyright.h>
11 #include <string.h>
12 #include <ctype.h>
13
14
15 /*      Function Name: RemoveHyphens
16  *      Description: Removes all hyphens from the string passed to it.
17  *      Arguments: str - the string to remove the hyphes from
18  *      Returns: none
19  */
20
21 void
22 RemoveHyphens(str)
23 char *str;
24 {
25     char *hyphen;
26
27     while ((hyphen = strchr(str, '-')) != (char *)0)
28         (void) strcpy(hyphen, hyphen + 1);
29 }
30
31
32 /*      Function Name: EncryptMITID
33  *      Description: Encrypts an mit ID number. 
34  *      Arguments: sbuf - the buffer to return the encrypted number in.
35  *                 idnumber - the id number (string).
36  *                 first, last - name of the person.
37  *      Returns: none.
38  */
39
40 void
41 EncryptID(sbuf, idnumber, first, last)
42 char *sbuf, *idnumber, *first, *last;
43 {
44     char salt[3];
45     extern char *crypt();
46
47     RemoveHyphens(idnumber);
48     salt[0] = tolower(last[0]);
49     salt[1] = tolower(first[0]);
50     salt[2] = 0;
51
52     (void) strcpy(sbuf, crypt(&idnumber[2], salt));
53 }
54
This page took 0.03824 seconds and 3 git commands to generate.