Hi Marek,

I arrived to do inner/outer hash with success.
Next step: store binary result into char static :)

Best regards

On Mon, Apr 14, 2008 at 5:42 PM, Badra <[EMAIL PROTECTED]> wrote:
> Hi Marek,
>
>
>
> > m1 has binary data, not string.
> > This data may have embeded 0x00 (look at your output above) and strcat
> > can not copy data in good place (to bytes before end instead of end of md1).
> > Use memcpy, does not relay of strlen() on such data too.
>
> I check for the output and the inner hash works correctly.
> I also used the memcpy instead of strcat but the problem still there.
>
> I don't know from where the problem comes, however, I tried the
> following and still doesn't work.
>
> static char *login="login";
> static char *password="password";
> static char *label="label";
>
> SHA_CTX inner, outer;
> char block[20];
> char blockin[strlen(label)];
>
> usigned char innerhash[20];
>
> //inner hash
> SHA_Init(&inner);
> SHA1_Update(&inner, login, strlen(login));
> SHA1_Update(&inner, password, strlen(password));
> SHA1_Final(innerhash, &inner);
>
>
> //outer hash
>
> memcpy(block, innerhash, sizeof(innerhash));
> memcpy(blockin, label, strlen(label));
>
> SHA_Init(&outer);
> SHA1_Update(&outer, block, 20);
> SHA1_Update(&inner, blockin, sizeof(blockin));
> SHA1_Final(innerhash, &outer);
>
> Best regards,
> Badra
>



-- 
Badra
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to