[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOLP8p7TX8COzgFVbmw+78uU4Geu1ErVmr5C0cs4XAaE73X8dg@mail.gmail.com>
Date: Sun, 6 Apr 2014 14:08:59 -0400
From: Bill Cox <waywardgeek@...il.com>
To: discussions@...sword-hashing.net
Subject: Re: [PHC] pufferfish
On Sun, Apr 6, 2014 at 10:56 AM, Jeremi Gosney <epixoip@...dshell.nl> wrote:
> On 4/6/2014 7:48 AM, Jeremi Gosney wrote:
>> This should work for what you want to do. But note that in this context
>> outlen is now specified in bits, not bytes.
>>
>> --- a/src/common/api.c
>> +++ b/src/common/api.c
>> @@ -123,18 +123,10 @@ int PHS (void *out, size_t outlen, const void *in,
>> size_t inlen, const void *sal
>> {
>> /* required PHS api */
>>
>> - char *hash;
>> - char *settings = pf_gensalt (salt, saltlen, t_cost, m_cost);
>> + unsigned char *bytes = pfkdf (outlen, in, t_cost, m_cost);
>>
>> - if (! (hash = (char *) pufferfish (in, inlen, settings, outlen,
>> false)))
>> - {
>> - free (settings);
>> - return 1;
>> - }
>> -
>> - memmove (out, hash, strlen (hash));
>> - free (settings);
>> - free (hash);
>> + memmove (out, bytes, outlen);
>> + free (bytes);
>>
>> return 0;
>> }
>
>
> Oops, sorry. That should be:
>
> memmove (out, bytes, outlen/8);
>
> Not
>
> memmove (out, bytes, outlen);
This looks good. If you don't mind, I'll pass outlen*8 to pfkdf
instead of dividing by 8 on the return. That will make outlen's
meaning match all the other entries.
Bill
Powered by blists - more mailing lists