2 * hostapd - Plaintext password to NtPasswordHash
3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "crypto/ms_funcs.h"
21 int main(int argc
, char *argv
[])
23 unsigned char password_hash
[16];
25 char *password
, buf
[64], *pos
;
30 if (fgets(buf
, sizeof(buf
), stdin
) == NULL
) {
31 printf("Failed to read password\n");
34 buf
[sizeof(buf
) - 1] = '\0';
36 while (*pos
!= '\0') {
37 if (*pos
== '\r' || *pos
== '\n') {
46 if (nt_password_hash((u8
*) password
, strlen(password
), password_hash
))
48 for (i
= 0; i
< sizeof(password_hash
); i
++)
49 printf("%02x", password_hash
[i
]);