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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.Crypto.Util.number</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.Util.html"><font color="#ffffff">Util</font></a>.number</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/Util/number.py">/home/afshar/wrk/gdata-python-client/src/gdata/Crypto/Util/number.py</a></font></td></tr></table>
<p><tt># number.py : Number-theoretic functions<br>
#<br>
# Part of the Python Cryptography Toolkit<br>
#<br>
# Distribute and use freely; there are no restrictions on further<br>
# dissemination and usage except those imposed by the laws of your<br>
# country of residence. This software is provided "as is" without<br>
# warranty of fitness for use or suitability for any purpose, express<br>
# or implied. Use at your own risk or not at all.<br>
#</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="Crypto.PublicKey._fastmath.html">Crypto.PublicKey._fastmath</a><br>
</td><td width="25%" valign=top><a href="struct.html">struct</a><br>
</td><td width="25%" valign=top><a href="warnings.html">warnings</a><br>
</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="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-GCD"><strong>GCD</strong></a>(x, y)</dt><dd><tt><a href="#-GCD">GCD</a>(x:long, y:long): long<br>
Return the GCD of x and y.</tt></dd></dl>
<dl><dt><a name="-bytes_to_long"><strong>bytes_to_long</strong></a>(s)</dt><dd><tt><a href="#-bytes_to_long">bytes_to_long</a>(string) : long<br>
Convert a byte string to a long integer.<br>
<br>
This is (essentially) the inverse of <a href="#-long_to_bytes">long_to_bytes</a>().</tt></dd></dl>
<dl><dt><a name="-getPrime"><strong>getPrime</strong></a>(N, randfunc)</dt><dd><tt><a href="#-getPrime">getPrime</a>(N:int, randfunc:callable):long<br>
Return a random N-bit prime number.</tt></dd></dl>
<dl><dt><a name="-getRandomNumber"><strong>getRandomNumber</strong></a>(N, randfunc)</dt><dd><tt><a href="#-getRandomNumber">getRandomNumber</a>(N:int, randfunc:callable):long<br>
Return an N-bit random number.</tt></dd></dl>
<dl><dt><a name="-inverse"><strong>inverse</strong></a>(u, v)</dt><dd><tt><a href="#-inverse">inverse</a>(u:long, u:long):long<br>
Return the inverse of u mod v.</tt></dd></dl>
<dl><dt><a name="-isPrime"><strong>isPrime</strong></a>(N)</dt><dd><tt><a href="#-isPrime">isPrime</a>(N:long):bool<br>
Return true if N is prime.</tt></dd></dl>
<dl><dt><a name="-long2str"><strong>long2str</strong></a>(n, blocksize<font color="#909090">=0</font>)</dt></dl>
<dl><dt><a name="-long_to_bytes"><strong>long_to_bytes</strong></a>(n, blocksize<font color="#909090">=0</font>)</dt><dd><tt><a href="#-long_to_bytes">long_to_bytes</a>(n:long, blocksize:int) : string<br>
Convert a long integer to a byte string.<br>
<br>
If optional blocksize is given and greater than zero, pad the front of the<br>
byte string with binary zeros so that the length is a multiple of<br>
blocksize.</tt></dd></dl>
<dl><dt><a name="-size"><strong>size</strong></a>(N)</dt><dd><tt><a href="#-size">size</a>(N:long) : int<br>
Returns the size of the number N in bits.</tt></dd></dl>
<dl><dt><a name="-str2long"><strong>str2long</strong></a>(s)</dt></dl>
</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: number.py,v 1.13 2003/04/04 18:21:07 akuchling Exp $'<br>
<strong>sieve</strong> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]</td></tr></table>
</body></html>
|