gdata.Crypto.Protocol.AllOrNothing | index /home/afshar/wrk/gdata-python-client/src/gdata/Crypto/Protocol/AllOrNothing.py

`This file implements all-or-nothing package transformations.
An all-or-nothing package transformation is one in which some text is
transformed into message blocks, such that all blocks must be obtained before
the reverse transformation can be applied. Thus, if any blocks are corrupted
or lost, the original message cannot be reproduced.
An all-or-nothing package transformation is not encryption, although a block
cipher algorithm is used. The encryption key is randomly generated and is
extractable from the message blocks.
This class implements the All-Or-Nothing package transformation algorithm
described in:
Ronald L. Rivest. "All-Or-Nothing Encryption and The Package Transform"
http://theory.lcs.mit.edu/~rivest/fusion.pdf`

Modules

``

operator | string |  |

Classes

``

AllOrNothing

class AllOrNothing
`` | `Class implementing the All-or-Nothing package transform. Methods for subclassing: _inventkey(key_size): Returns a randomly generated key. Subclasses can use this to implement better random key generating algorithms. The default algorithm is probably not very cryptographically secure.`

Methods defined here:

__init__(self, ciphermodule, mode=None, IV=None)
  `AllOrNothing(ciphermodule, mode=None, IV=None)
  ciphermodule is a module implementing the cipher algorithm to
  use. It must provide the PEP272 interface.
  Note that the encryption key is randomly generated
  automatically when needed. Optional arguments mode and IV are
  passed directly through to the ciphermodule.new() method; they
  are the feedback mode and initialization vector to use. All
  three arguments must be the same for the object used to create
  the digest, and to undigest'ify the message blocks.`

digest(self, text)
  `digest(text:string) : [string]
  Perform the All-or-Nothing package transform on the given
  string. Output is a list of message blocks describing the
  transformed text, where each block is a string of bit length equal
  to the ciphermodule's block_size.`

undigest(self, blocks)
  `undigest(blocks : [string]) : string
  Perform the reverse package transformation on a list of message
  blocks. Note that the ciphermodule used for both transformations
  must be the same. blocks is a list of strings of bit length
  equal to the ciphermodule's block_size.`

Data
`` |  | __revision__ = '$Id: AllOrNothing.py,v 1.8 2003/02/28 15:23:20 akuchling Exp $'