]>
git.ipfire.org Git - thirdparty/hostap.git/blob - hostapd/nt_password_hash.c
2 * hostapd - Plaintext password to NtPasswordHash
3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "crypto/ms_funcs.h"
15 int main(int argc
, char *argv
[])
17 unsigned char password_hash
[16];
19 char *password
, buf
[64], *pos
;
24 if (fgets(buf
, sizeof(buf
), stdin
) == NULL
) {
25 printf("Failed to read password\n");
28 buf
[sizeof(buf
) - 1] = '\0';
30 while (*pos
!= '\0') {
31 if (*pos
== '\r' || *pos
== '\n') {
40 if (nt_password_hash((u8
*) password
, strlen(password
), password_hash
))
42 for (i
= 0; i
< sizeof(password_hash
); i
++)
43 printf("%02x", password_hash
[i
]);