crypt.c 797 B

123456789101112131415161718192021222324252627
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * crypt() for uClibc
  4. *
  5. * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
  6. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  7. *
  8. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  9. */
  10. /* Written by Erik Andersen <andersen@uclibc.org> */
  11. #define __FORCE_GLIBC
  12. #include <crypt.h>
  13. #include <unistd.h>
  14. extern char * __md5_crypt( const char *pw, const char *salt) attribute_hidden;
  15. extern char * __des_crypt( const char *pw, const char *salt) attribute_hidden;
  16. char * crypt(const char *key, const char *salt)
  17. {
  18. /* First, check if we are supposed to be using the MD5 replacement
  19. * instead of DES... */
  20. if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
  21. return __md5_crypt(key, salt);
  22. else
  23. return __des_crypt(key, salt);
  24. }