On Tue, 2012-11-27 at 14:06 +0100, Niels Möller wrote:
> Fredrik Thulin <[email protected]> writes:
> 
> > I just published a module used in some PBKDF2-HMAC-SHA512 testing I've
> > been doing under a contract with NORDUnet A/S.
> >
> >   https://github.com/fredrikt/python-ndnkdf
> 
> Cool. Why SHA512 rather than SHA256, is using it specified somewhere?

I wanted maximum speed on 64 bits CPUs without settling for SHA-1, but I
won't claim this was a particularly well illuminated decision.

> If PBKDF2-HMAC-SHA512 is widely used, it would sense to add a
> convenience function pbkdf2_hmac_sha512 to nettle.

I wouldn't mind that, although I've already failed to convince Simon =).

It would remove the hack of passing a 1k buffer as sha512ctx
(https://github.com/fredrikt/python-ndnkdf/blob/master/ndnkdf/ndnkdf.py#L76).

> What's the source of your test vectors? It would be nice with additional
> test vectors also for nettle's testsuite/pbkdf2-test.c.

IIRC I actually took the test vectors *from* Nettle - my basic concern
with testing was to verify that I was successfully calling libnettle,
not that libnettle works.

I did implement a test case that compares the output of Nettle with that
of python-pbkdf2 for a number of (key, salt, iterations) though.

> > I invoke the new PBKDF2 functions in libnettle using Python ctypes,
> > which achieves a ~ 25x speedup compared to the standard python-pbkdf2
> > that uses SHA512 from hashlib (presumably a C function), but does the
> > xoring in native Python.
> 
> Is the speed of sha512 itself comparable? Nettle's implementatiion is
> fairly straight-forward C code.

Haven't measured. Optimizing a SHA512 implementation is really above my
head, but I've heard talks about using AMD XOP instruction set to
optimize SHA512 on other mailing lists... 

> > If someone has access to a modern AMD CPU, I would be very interested in
> > getting the benchmark output of examples/pbkdf2-plot on that machine.
> > Thanks.
> 
> My machine at home is a lowend but reasonably modern AMD, E-350, iirc.
> I'm not very familiar with python, but if you tell me the steps needed
> to get the benchmark running on a debian system I can give it a try.

Thanks. Something like

  $ git clone https://github.com/dlitz/python-pbkdf2
  $ git clone https://github.com/fredrikt/python-ndnkdf
  $ cd python-ndnkdf/examples
  $ PYTHONPATH=../../python-pbkdf2 ./pbkdf2-plot

(assuming there is a new enough libnettle in the system library path).

/Fredrik


_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to