1 /* vi: set sw=4 ts=4: */
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.
13 char *crypt(const char *key, const char *salt)
15 const unsigned char *ukey = (const unsigned char *)key;
16 const unsigned char *usalt = (const unsigned char *)salt;
18 if (salt[0] == '$' && salt[2] == '$') {
20 return __md5_crypt(ukey, usalt);
21 #ifdef __UCLIBC_HAS_SHA256_CRYPT_IMPL__
22 else if (*salt == '5')
23 return __sha256_crypt(ukey, usalt);
25 #ifdef __UCLIBC_HAS_SHA512_CRYPT_IMPL__
26 else if (*salt == '6')
27 return __sha512_crypt(ukey, usalt);
30 return __des_crypt(ukey, usalt);