catacomb/__init__.py: Refactor the XDH and EdDSA classes.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 11 May 2017 09:42:15 +0000 (10:42 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 14 May 2017 03:29:42 +0000 (04:29 +0100)
commit925aa45b22569dd0d08a695a89602f1781085f89
treec9ac846b086ab6e1d4605c5d3d49761531282193
parent34bea1860bbbf768746ccacdd608e1a68ff01c01
catacomb/__init__.py: Refactor the XDH and EdDSA classes.

  * Introduce `_BasePub' and `_BasePriv' underneath the existing
    classes, and move obvious common functionality like size checking
    and printing into them.  Push key-generation down here too.

  * Use `KeySZ' objects for key length checking rather than just the
    bare constants.  In particular, this means that `Ed25519Priv' isn't
    fussy about key sizes, preserving this feature of the underlying
    implementation.

  * Split the implementation of pretty-printing into more pieces.  In
    particular, now `_BasePriv' only needs to implement the printing of
    the private key rather than the whole lot.  (Plain `__repr__' is
    still duplicated, but the code is smaller and this is more
    tolerable.)

  * Rename `_Boxy...' to `_XDH...', since this appears to be the generic
    term I'm using for such things now.
catacomb/__init__.py