djb suggested I email this list and solicit any suggestions for Python
bindings for NaCl.
I sent an RFC patch to djb last week containing a suggested set of
bindings which worked like this:
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nacl
>>> nacl.hash('test')
'\xee&\xb0\xddJ\xf7\xe7I\xaa\x1a\x8e\xe3\xc1\n\xe9\x92?a\x89\x80w.G?\x88\x19\xa5\xd4\x94\x0e\r\xb2z\xc1\x85\xf8\xa0\xe1\xd5\xf8O\x88\xbc\x88\x7f\xd6{\x1472\xc3\x04\xcc_\xa9\xad\x8eoW\xf5\x00(\xa8\xff'
>>> nacl.hash_md5('test')
"\t\x8fk\xcdF!\xd3s\xca\xdeN\x83&'\xb4\xf6"
>>> dir(nacl)
['__doc__', '__file__', '__name__', 'auth', 'auth_hmacmd5',
'auth_hmacsha256', 'auth_hmacsha512', 'hash', 'hash_md5',
'hash_sha256', 'hash_sha512', 'secretbox_salsa20hmacsha512',
'streamxor', 'streamxor_salsa20', 'streamxor_salsa2012',
'streamxor_salsa208', 'verify16', 'verify32']
Thus the bindings match the C interface very closely. There's a
default function (i.e. 'hash') and a series of specific functions
(i.e. 'hash_sha256'), again like the C interface. The arguments to the
functions match the C interface where:
* outputs are returned, rather than passing a pointer in
* 'string' inputs can be unicode and will be serialised using the
default codec
* 'key' inputs must be plain strings
This is for Python 2.x. For 3.0 the the two types of strings are more distinct.
Milestones on the path:
* Getting NaCl to build as a shared library. I've already managed
this with a hack but it needs to be done properly
* Getting the ELF DSO visibility correct for all the symbols. Fiddly.
I don't have the current patch on this box, but it's available on request.
Comment away. Or just email me Python code that you wished worked and
I'll see if I can make it so.
Cheers
AGL
--
Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org
_______________________________________________
viff-devel mailing list (http://viff.dk/)
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk