crypt.c 686 B

1234567891011121314151617181920212223
  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. */
  7. #define __FORCE_GLIBC
  8. #include <crypt.h>
  9. #include <unistd.h>
  10. extern char * __md5_crypt( const char *pw, const char *salt) attribute_hidden;
  11. extern char * __des_crypt( const char *pw, const char *salt) attribute_hidden;
  12. char * crypt(const char *key, const char *salt)
  13. {
  14. /* First, check if we are supposed to be using the MD5 replacement
  15. * instead of DES... */
  16. if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
  17. return __md5_crypt(key, salt);
  18. else
  19. return __des_crypt(key, salt);
  20. }