pynacl

Python wrapper for http://nacl.cace-project.eu/
git clone https://code.literati.org/pynacl.git
Log | Files | Refs | README

README.md (2093B)


      1 PyNaCl: A Python Wrapper for NaCl
      2 ========================
      3 
      4 Overview
      5 --------
      6 
      7 This is a simple wrapper for the [NaCl](http://nacl.cace-project.eu/)
      8 cryptographic library (not Google's NativeClient).
      9 
     10 
     11 Features
     12 --------
     13 
     14 PyNaCl currently wraps the following NaCl functions:
     15 
     16 * crypto\_hash\_sha256
     17 * crypto\_hash\_sha512
     18 * crypto\_randombytes
     19 
     20 And the following groups of functions (if not otherwise specified by
     21 the suffix, it just wraps the default primitive):
     22 
     23 * crypto\_scalarmult\_curve25519
     24 * crypto\_box
     25 * crypto\_sign
     26 * crypto\_secretbox
     27 * crypto\_stream
     28 * crypto\_auth
     29 * crypto\_onetimeauth
     30 
     31 
     32 API
     33 ---
     34 
     35 The API is a very straightforward translation of NaCl's C API. Any
     36 function that returns an error code will raise ValueError if it
     37 returns anything but zero. Output arguments are returned, with keypair
     38 functions returning 2-tuples and everything else returning
     39 strings. The wrapper handles all padding, so you can just ignore that
     40 part of NaCl's documentation.
     41 
     42 Eventually I'll translate the documentation over, but for now look at
     43 test.py and the [NaCl documentation](http://nacl.cace-project.eu/).
     44 
     45 
     46 Installation
     47 ----------
     48 
     49 SWIG is required to generate the wrapper:
     50 
     51     apt-get install swig
     52 
     53 Download pynacl with the embedded NaCL (verify it's the latest version):
     54 
     55     git clone git@github.com:seanlynch/pynacl.git
     56 
     57 NaCl does not build with the -fPIC flag and therefore you must modify a file:
     58 
     59     cd pynacl/nacl-20110221
     60     sed -i "s/$/ -fPIC/" okcompilers/c*
     61     
     62 If you want the build status output printed to screen, you may also do:
     63     
     64     sed -i "s/exec 2\?>.*//" do
     65     
     66 You can then build NaCl with:
     67     
     68     ./do
     69 
     70 Once NaCl is successfully built, you can run:
     71 
     72     cd ../
     73     python setup.py build
     74     sudo python setup.py install
     75 
     76 Testing
     77 -------
     78 
     79 To run the tests, just run the script "test.py" in the distribution directory.
     80 
     81 
     82 License
     83 ------
     84 
     85 PyNaCl is released under version 2.0 of the Apache license.
     86 
     87 
     88 To do
     89 -----
     90 
     91 * Convert to a package so I can add Python code
     92 * Implement a higher-level API
     93 * Implement fromseed versions of other key generation functions