nt_password_hash.c

Go to the documentation of this file.
00001 
00016 #include "includes.h"
00017 
00018 #include "common.h"
00019 #include "ms_funcs.h"
00020 
00021 
00022 int main(int argc, char *argv[])
00023 {
00024         unsigned char password_hash[16];
00025         size_t i;
00026         char *password, buf[64], *pos;
00027 
00028         if (argc > 1)
00029                 password = argv[1];
00030         else {
00031                 if (fgets(buf, sizeof(buf), stdin) == NULL) {
00032                         printf("Failed to read password\n");
00033                         return 1;
00034                 }
00035                 buf[sizeof(buf) - 1] = '\0';
00036                 pos = buf;
00037                 while (*pos != '\0') {
00038                         if (*pos == '\r' || *pos == '\n') {
00039                                 *pos = '\0';
00040                                 break;
00041                         }
00042                         pos++;
00043                 }
00044                 password = buf;
00045         }
00046 
00047         if (nt_password_hash((u8 *) password, strlen(password), password_hash))
00048                 return -1;
00049         for (i = 0; i < sizeof(password_hash); i++)
00050                 printf("%02x", password_hash[i]);
00051         printf("\n");
00052 
00053         return 0;
00054 }
00055 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:16:48 2009 for hostapd by  doxygen 1.6.1