Exemplo n.º 1
0
int
E_md4hash(const unsigned char *passwd, unsigned char *p16)
{
    int rc;
    int len;
    __u16 wpwd[129];

    /* Password cannot be longer than 128 characters */
    if (passwd) {
        len = strlen((char *) passwd);
        if (len > 128)
            len = 128;

        /* Password must be converted to NT unicode */
        _my_mbstowcs(wpwd, passwd, len);
    } else
        len = 0;

    wpwd[len] = 0;	/* Ensure string is null terminated */
    /* Calculate length in bytes */
    len = _my_wcslen(wpwd) * sizeof(__u16);

    rc = mdfour(p16, (unsigned char *) wpwd, len);
    memset(wpwd, 0, 129 * 2);

    return rc;
}
Exemplo n.º 2
0
void E_md4hash(uchar *passwd, uchar *p16)
{
	int len;
	int16 wpwd[129];
	
	/* Password cannot be longer than 128 characters */
	len = strlen((char *)passwd);
	if(len > 128)
		len = 128;
	/* Password must be converted to NT unicode */
	_my_mbstowcs(wpwd, passwd, len);
	wpwd[len] = 0; /* Ensure string is null terminated */
	/* Calculate length in bytes */
	len = _my_wcslen(wpwd) * sizeof(int16);

	mdfour(p16, (unsigned char *)wpwd, len);
}