1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.Crypto.Protocol.AllOrNothing</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.Crypto.html"><font color="#ffffff">Crypto</font></a>.<a href="gdata.Crypto.Protocol.html"><font color="#ffffff">Protocol</font></a>.AllOrNothing</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/afshar/wrk/gdata-python-client/src/gdata/Crypto/Protocol/AllOrNothing.py">/home/afshar/wrk/gdata-python-client/src/gdata/Crypto/Protocol/AllOrNothing.py</a></font></td></tr></table>
<p><tt>This file implements all-or-nothing package transformations.<br>
<br>
An all-or-nothing package transformation is one in which some text is<br>
transformed into message blocks, such that all blocks must be obtained before<br>
the reverse transformation can be applied. Thus, if any blocks are corrupted<br>
or lost, the original message cannot be reproduced.<br>
<br>
An all-or-nothing package transformation is not encryption, although a block<br>
cipher algorithm is used. The encryption key is randomly generated and is<br>
extractable from the message blocks.<br>
<br>
This class implements the All-Or-Nothing package transformation algorithm<br>
described in:<br>
<br>
Ronald L. Rivest. "All-Or-Nothing Encryption and The Package Transform"<br>
<a href="http://theory.lcs.mit.edu/~rivest/fusion.pdf">http://theory.lcs.mit.edu/~rivest/fusion.pdf</a></tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="operator.html">operator</a><br>
</td><td width="25%" valign=top><a href="string.html">string</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.Crypto.Protocol.AllOrNothing.html#AllOrNothing">AllOrNothing</a>
</font></dt></dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="AllOrNothing">class <strong>AllOrNothing</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Class implementing the All-or-Nothing package transform.<br>
<br>
Methods for subclassing:<br>
<br>
_inventkey(key_size):<br>
Returns a randomly generated key. Subclasses can use this to<br>
implement better random key generating algorithms. The default<br>
algorithm is probably not very cryptographically secure.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="AllOrNothing-__init__"><strong>__init__</strong></a>(self, ciphermodule, mode<font color="#909090">=None</font>, IV<font color="#909090">=None</font>)</dt><dd><tt><a href="#AllOrNothing">AllOrNothing</a>(ciphermodule, mode=None, IV=None)<br>
<br>
ciphermodule is a module implementing the cipher algorithm to<br>
use. It must provide the <a href="http://www.python.org/dev/peps/pep-0272/">PEP272</a> interface.<br>
<br>
Note that the encryption key is randomly generated<br>
automatically when needed. Optional arguments mode and IV are<br>
passed directly through to the ciphermodule.new() method; they<br>
are the feedback mode and initialization vector to use. All<br>
three arguments must be the same for the object used to create<br>
the digest, and to undigest'ify the message blocks.</tt></dd></dl>
<dl><dt><a name="AllOrNothing-digest"><strong>digest</strong></a>(self, text)</dt><dd><tt><a href="#AllOrNothing-digest">digest</a>(text:string) : [string]<br>
<br>
Perform the All-or-Nothing package transform on the given<br>
string. Output is a list of message blocks describing the<br>
transformed text, where each block is a string of bit length equal<br>
to the ciphermodule's block_size.</tt></dd></dl>
<dl><dt><a name="AllOrNothing-undigest"><strong>undigest</strong></a>(self, blocks)</dt><dd><tt><a href="#AllOrNothing-undigest">undigest</a>(blocks : [string]) : string<br>
<br>
Perform the reverse package transformation on a list of message<br>
blocks. Note that the ciphermodule used for both transformations<br>
must be the same. blocks is a list of strings of bit length<br>
equal to the ciphermodule's block_size.</tt></dd></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__revision__</strong> = '$Id: AllOrNothing.py,v 1.8 2003/02/28 15:23:20 akuchling Exp $'</td></tr></table>
</body></html>
|