Package yawPyCrypto :: Module _CipherBase :: Class EncryptBase
[show private | hide private]
[frames | no frames]

Class EncryptBase

object --+
         |
        EncryptBase

Known Subclasses:
EncryptCipher, ZipEncryptCipher, KeyEncryptCipher, ZipKeyEncryptCipher

EncryptBase is an abstract base class which implements the feed() and finish() methods of a cipher class. feed() takes string data, which is fed to the encryption, and finally written out to the underlying stream. finish() ends the stream, writing out end of stream signatures.
Method Summary
  __init__(self, password, cipher_algo, cipher_mode, IV, hash_algo)
Initialize the encryption cipher.
a new object with type S, a subtype of T __new__(S, ...)
  feed(self, data)
Feed data to the encryption.
  finish(self)
Finish the encryption stream.
  _encryptionEnd(self)
Write out the encryption end packet.
  _encryptionHeader(self)
Overridable function which writes an additional encryption header.
  _encryptionRandom(self)
Write out the random first block of data.
  _encryptionSignature(self)
Overridable function which writes an additional encryption signature.

Class Variable Summary
bool _showpassword

Method Details

__init__(self, password=None, cipher_algo=3, cipher_mode=0, IV=None, hash_algo=5)
(Constructor)

Initialize the encryption cipher. The arguments this class takes are passed to the encryption start functions of the cipher stream which is associated with this class when creating the actual instance.

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

feed(self, data)

Feed data to the encryption. The parameter must be a string. Output isn't producted necessarily, unless data is long enough to fill the internal buffering of the encryption buffer and (possibly) the zlib buffer.

finish(self)

Finish the encryption stream. This writes out the last packet of data and an encryption end signature. After this function has been called, all further calls to feed are disallowed, and will fail, invalidating the stream. No more data will be written to the output after this function has been called.

_encryptionEnd(self)

Write out the encryption end packet. The encryption end packet contains a hash digest of the original data which has been written, and the length of the actual data, without fillers added to pad it up to a multiple of block_size.

_encryptionHeader(self)

Overridable function which writes an additional encryption header. This is used in the KeyCipher* classes. The default implementation does nothing.

_encryptionRandom(self)

Write out the random first block of data. The default implementation writes block_size bytes of data on block cipher algorithms, and 128 bytes of random data on stream cipher algorithms. The latter works around a problem with the RC5 key scheduling algorithm.

_encryptionSignature(self)

Overridable function which writes an additional encryption signature. This is used in the KeyCipher* classes. The default implementation does nothing.

Class Variable Details

_showpassword

Type:
bool
Value:
True                                                                   

Generated by Epydoc 1.1 on Sun Aug 17 03:32:34 2003 http://epydoc.sf.net