23 RCSID(
"$Id: 6054089af296bf4d0338527b7eb06ead7dc3d4cf $")
25 #include <freeradius-devel/util/misc.h>
26 #include <freeradius-devel/util/md4.h>
27 #include <freeradius-devel/util/md5.h>
28 #include <freeradius-devel/util/sha1.h>
35 static char const hex[] =
"0123456789ABCDEF";
40 static void tohex (
unsigned char const *src,
size_t len,
char *dst)
43 for (i=0; i<len; i++) {
44 dst[(i*2)] =
hex[(src[i] >> 4)];
45 dst[(i*2) + 1] =
hex[(src[i]&0x0F)];
55 len =
fr_utf8_to_ucs2(ucs2_password,
sizeof(ucs2_password), password, strlen(password));
63 int main (
int argc,
char *argv[])
71 fprintf(stderr,
"LM Hash \tNT Hash\n");
72 fprintf(stderr,
"--------------------------------\t--------------------------------\n");
74 for (i = 1; i < argc; i++ ) {
75 strlcpy(password, argv[i],
sizeof(password));
77 if (l && password[l-1] ==
'\n') password [l-1] = 0;
82 printf(
"%s\t%s\n", lmpass, ntpass);
void fr_md4_calc(uint8_t out[static MD4_DIGEST_LENGTH], uint8_t const *in, size_t inlen)
Calculate the MD4 hash of the contents of a buffer.
ssize_t fr_utf8_to_ucs2(uint8_t *out, size_t outlen, char const *in, size_t inlen)
Convert UTF8 string to UCS2 encoding.
static unsigned int hash(char const *username, unsigned int tablesize)
void smbdes_lmpwdhash(char const *password, uint8_t *lmhash)
int main(int argc, char *argv[])
static void ntpwdhash(uint8_t *out, char const *password)
static void tohex(unsigned char const *src, size_t len, char *dst)
size_t strlcpy(char *dst, char const *src, size_t siz)
static size_t char ** out