[PYTHON-CRYPTO] PyCrypto Draft: Proposal 2001-02-18

Michael Ströder michael at STROEDER.COM
Mon Feb 19 00:37:18 CET 2001


Dan Parisien wrote:
>
> >  - Passing arguments in factory function
> > PyCrypto.registry.getInstance()
> >    to __init__() methods of implementation classes.
>
> As classes are a type just like any other, why not just return a reference
> to the class and instantiate that?

I already thought about just returning the class. Well, some people
might be concerned about having to instantiate the object themselves
(one extra line of code). We can provide both. No problem.

> >  - Performance? (mainly startup latency)
>
> Q - Does this only apply when you need to access the implementation
> registry?
> If you do not need the implementation registry, could you not use it?

Off course you can import the implementation modules directly.

> Also, could the registry be implemented as a pickled dictionary contained in
> a simple text file? Because it will be written to infrequently and read from
> often... It may speed up the loading process.

I did some experiments with reading pickled (binary, cPickle) config
files instead of config modules when doing CGI-BIN programming. It
was slower than importing a config modules in my case. Also the
registry itself is built by the implementation modules. The
important thing is to avoid unnecessary import's in the PyCrypto
module itself. E.g. someone just wanting to use a hash function
should not be bothered with startup latency from importing a SSL
module...

> >  - Implementors here should think about how to tie their modules to
> >    this loader.
>
> Add themselves to the pickled file in their setup.py distutils script?

No. Call PyCrypto.registerImplementation() to register compliant
implementation classes. But the cipher base classes yet have to be
defined.

> I will read the code later.

Most times my code is ahead my documentation...

Ciao, Michael.





More information about the python-crypto mailing list