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