Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. hashpwd.c
  5. Abstract:
  6. Implements a tool that outputs the encrypted form of an input clear-text password
  7. Author:
  8. Ovidiu Temereanca (ovidiut) 27-Mar-2000
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. #include <windows.h>
  13. #include <stdio.h>
  14. #include <tchar.h>
  15. #include "encrypt.h"
  16. INT
  17. __cdecl
  18. _tmain (
  19. INT argc,
  20. TCHAR *argv[]
  21. )
  22. {
  23. LONG rc;
  24. TCHAR owfPwd[STRING_ENCODED_PASSWORD_SIZE];
  25. if (argc < 2 ||
  26. ((argv[1][0] == TEXT('/') || argv[1][0] == TEXT('-')) && argv[1][1] == TEXT('?'))) {
  27. _tprintf (TEXT("Usage:\n")
  28. TEXT(" hashpwd <password>\n")
  29. TEXT("Use quotes if <password> contains spaces\n")
  30. );
  31. return 1;
  32. }
  33. if (StringEncodeOwfPassword (argv[1], owfPwd, NULL)) {
  34. _tprintf (TEXT("%s=%s\n"), argv[1], owfPwd);
  35. } else {
  36. _ftprintf (stderr, TEXT("StringEncodeOwfPassword failed\n"));
  37. }
  38. return 0;
  39. }