+libcrypt
[meinos.git] / apps / lib / libcrypt / crypt.c
blob8b361d393937d3cd7975357eb7c075c9941f29bb
1 /* vi: set sw=4 ts=4: */
2 /*
3 * crypt() for uClibc
4 * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 */
8 #define __FORCE_GLIBC
9 #include <crypt.h>
10 #include <unistd.h>
11 #include "libcrypt.h"
13 char *crypt(const char *key, const char *salt)
15 /* First, check if we are supposed to be using the MD5 replacement
16 * instead of DES... */
17 if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
18 return __md5_crypt((unsigned char*)key, (unsigned char*)salt);
19 else
20 return __des_crypt((unsigned char*)key, (unsigned char*)salt);