]> andersk Git - moira.git/blame - lib/idno.c
added UREG_HALF_ENROLLED; SMS->Moira
[moira.git] / lib / idno.c
CommitLineData
b93ad422 1/* $Header$
2 *
3 * Routines to encrypt ID's
babbc197 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>.
b93ad422 8 */
9
babbc197 10#include <mit-copyright.h>
b93ad422 11#include <strings.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
21void
22RemoveHyphens(str)
23char *str;
24{
25 char *hyphen;
26
27 while ((hyphen = index(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
40void
41EncryptID(sbuf, idnumber, first, last)
42char *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 2.71101 seconds and 5 git commands to generate.