cryptosphere/rbnacl — pull request #30 by tarcieri (2013-02-12 07:33:46+00:00)
Title: Crypto::Point API for Curve25519

So I've been learning a little bit more about Edwards curves, and I was
thinking about the OpenSSL::PKey::EC::Point API (as horrid as that name
is, and as horrid as the API is) and thought this might be another way
to rework scalar multiplication into an object oriented API.

How did it turn out? OK, I think, it's object oriented, but not really
arguably better except that with another line of code it could have some
(somewhat useless) support for encodings. I left that out for now, but
you can see how with the standard group element constant declared as
hex being able to decode hex would be nice (many on the #tahoe-lafs
trolled the previous serialization which started "\t\0\0..." ;)

One thing I don't like about the API is that apparently the commonly
accepted ordering for group multiplication is:

integer * Point

This API forces:

Point.mult(integer)

Which is effectively backwards.

I didn't preserve the original class methods, but with the ability to do
Crypto::Point.base.mult(integer) I really don't think it matters.