diff options
Diffstat (limited to 'docs/paramiko.rng-pysrc.html')
-rw-r--r-- | docs/paramiko.rng-pysrc.html | 368 |
1 files changed, 0 insertions, 368 deletions
diff --git a/docs/paramiko.rng-pysrc.html b/docs/paramiko.rng-pysrc.html deleted file mode 100644 index 4555c63..0000000 --- a/docs/paramiko.rng-pysrc.html +++ /dev/null @@ -1,368 +0,0 @@ -<?xml version="1.0" encoding="ascii"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title>paramiko.rng</title> - <link rel="stylesheet" href="epydoc.css" type="text/css" /> - <script type="text/javascript" src="epydoc.js"></script> -</head> - -<body bgcolor="white" text="black" link="blue" vlink="#204080" - alink="#204080"> -<!-- ==================== NAVIGATION BAR ==================== --> -<table class="navbar" border="0" width="100%" cellpadding="0" - bgcolor="#a0c0ff" cellspacing="0"> - <tr valign="middle"> - <!-- Home link --> - <th> <a - href="paramiko-module.html">Home</a> </th> - - <!-- Tree link --> - <th> <a - href="module-tree.html">Trees</a> </th> - - <!-- Index link --> - <th> <a - href="identifier-index.html">Indices</a> </th> - - <!-- Help link --> - <th> <a - href="help.html">Help</a> </th> - - <th class="navbar" width="100%"></th> - </tr> -</table> -<table width="100%" cellpadding="0" cellspacing="0"> - <tr valign="top"> - <td width="100%"> - <span class="breadcrumbs"> - <a href="paramiko-module.html">Package paramiko</a> :: - Module rng - </span> - </td> - <td> - <table cellpadding="0" cellspacing="0"> - <!-- hide/show private --> - <tr><td align="right"><span class="options" - >[<a href="frames.html" target="_top">frames</a - >] | <a href="paramiko.rng-pysrc.html" - target="_top">no frames</a>]</span></td></tr> - </table> - </td> - </tr> -</table> -<h1 class="epydoc">Source Code for <a href="paramiko.rng-module.html" onclick="show_private();">Module paramiko.rng</a></h1> -<pre class="py-src"> -<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment">#!/usr/bin/python</tt> </tt> -<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"># -*- coding: ascii -*-</tt> </tt> -<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-comment"># Copyright (C) 2008 Dwayne C. Litzenberger <dlitz@dlitz.net></tt> </tt> -<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt> -<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment"># This file is part of paramiko.</tt> </tt> -<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt> -<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"># Paramiko is free software; you can redistribute it and/or modify it under the</tt> </tt> -<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"># terms of the GNU Lesser General Public License as published by the Free</tt> </tt> -<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"># Software Foundation; either version 2.1 of the License, or (at your option)</tt> </tt> -<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment"># any later version.</tt> </tt> -<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt> -<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"># Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY</tt> </tt> -<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"># WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR</tt> </tt> -<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"># A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more</tt> </tt> -<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-comment"># details.</tt> </tt> -<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt> -<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"># You should have received a copy of the GNU Lesser General Public License</tt> </tt> -<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-comment"># along with Paramiko; if not, write to the Free Software Foundation, Inc.,</tt> </tt> -<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-comment"># 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</tt> </tt> -<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"> </tt> -<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt> -<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">threading</tt> </tt> -<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">Crypto</tt><tt class="py-op">.</tt><tt class="py-name">Util</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable paramiko.auth_handler.randpool=paramiko.auth_handler-module.html#randpool,Variable paramiko.channel.randpool=paramiko.channel-module.html#randpool,Variable paramiko.client.randpool=paramiko.client-module.html#randpool,Variable paramiko.common.randpool=paramiko.common-module.html#randpool,Variable paramiko.dsskey.randpool=paramiko.dsskey-module.html#randpool,Variable paramiko.hostkeys.randpool=paramiko.hostkeys-module.html#randpool,Variable paramiko.kex_gex.randpool=paramiko.kex_gex-module.html#randpool,Variable paramiko.kex_group1.randpool=paramiko.kex_group1-module.html#randpool,Variable paramiko.packet.randpool=paramiko.packet-module.html#randpool,Variable paramiko.pkey.randpool=paramiko.pkey-module.html#randpool,Variable paramiko.rsakey.randpool=paramiko.rsakey-module.html#randpool,Variable paramiko.server.randpool=paramiko.server-module.html#randpool,Variable paramiko.sftp.randpool=paramiko.sftp-module.html#randpool,Variable paramiko.sftp_attr.randpool=paramiko.sftp_attr-module.html#randpool,Variable paramiko.sftp_client.randpool=paramiko.sftp_client-module.html#randpool,Variable paramiko.sftp_file.randpool=paramiko.sftp_file-module.html#randpool,Variable paramiko.sftp_handle.randpool=paramiko.sftp_handle-module.html#randpool,Variable paramiko.sftp_server.randpool=paramiko.sftp_server-module.html#randpool,Variable paramiko.sftp_si.randpool=paramiko.sftp_si-module.html#randpool,Variable paramiko.transport.randpool=paramiko.transport-module.html#randpool,Variable paramiko.util.randpool=paramiko.util-module.html#randpool"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-0', 'randpool', 'link-0');">randpool</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">RandomPool</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_RandomPool</tt> </tt> -<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"> </tt> -<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> -<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">platform</tt> </tt> -<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt> -<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"> <tt class="py-name">platform</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> <tt class="py-comment"># Not available using Python 2.2</tt> </tt> -<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"> </tt> -<a name="_strxor"></a><div id="_strxor-def"><a name="L30"></a><tt class="py-lineno"> 30</tt> <a class="py-toggle" href="#" id="_strxor-toggle" onclick="return toggle('_strxor');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng-module.html#_strxor">_strxor</a><tt class="py-op">(</tt><tt class="py-param">a</tt><tt class="py-op">,</tt> <tt class="py-param">b</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="_strxor-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_strxor-expanded"><a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"> <tt class="py-keyword">assert</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">a</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">b</tt><tt class="py-op">)</tt> </tt> -<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">""</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">map</tt><tt class="py-op">(</tt><tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">:</tt> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">ord</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">)</tt> <tt class="py-op">^</tt> <tt class="py-name">ord</tt><tt class="py-op">(</tt><tt class="py-name">y</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">a</tt><tt class="py-op">,</tt> <tt class="py-name">b</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> -</div><a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> </tt> -<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"><tt class="py-comment">##</tt> </tt> -<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"><tt class="py-comment">## Find a strong random entropy source, depending on the detected platform.</tt> </tt> -<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt class="py-comment">## WARNING TO DEVELOPERS: This will fail on some systems, but do NOT use</tt> </tt> -<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt class="py-comment">## Crypto.Util.randpool.RandomPool as a fall-back. RandomPool will happily run</tt> </tt> -<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"><tt class="py-comment">## with very little entropy, thus _silently_ defeating any security that</tt> </tt> -<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt class="py-comment">## Paramiko attempts to provide. (This is current as of PyCrypto 2.0.1).</tt> </tt> -<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"><tt class="py-comment">## See http://www.lag.net/pipermail/paramiko/2008-January/000599.html</tt> </tt> -<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"><tt class="py-comment">## and http://www.lag.net/pipermail/paramiko/2008-April/000678.html</tt> </tt> -<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"><tt class="py-comment">##</tt> </tt> -<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"> </tt> -<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">platform</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt> <tt class="py-keyword">and</tt> <tt class="py-name">platform</tt><tt class="py-op">.</tt><tt class="py-name">system</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">lower</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-string">'windows'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt> -<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">platform</tt> <tt class="py-op">==</tt> <tt class="py-string">'win32'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"> <tt class="py-comment"># MS Windows</tt> </tt> -<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package paramiko=paramiko-module.html"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-1', 'paramiko', 'link-1');">paramiko</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module paramiko.rng_win32=paramiko.rng_win32-module.html"><a title="paramiko.rng_win32" class="py-name" href="#" onclick="return doclink('link-2', 'rng_win32', 'link-2');">rng_win32</a></tt> </tt> -<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> <tt id="link-3" class="py-name" targets="Variable paramiko.rng.rng_device=paramiko.rng-module.html#rng_device"><a title="paramiko.rng.rng_device" class="py-name" href="#" onclick="return doclink('link-3', 'rng_device', 'link-3');">rng_device</a></tt> <tt class="py-op">=</tt> <tt id="link-4" class="py-name"><a title="paramiko.rng_win32" class="py-name" href="#" onclick="return doclink('link-4', 'rng_win32', 'link-2');">rng_win32</a></tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Function paramiko.rng_posix.open_rng_device()=paramiko.rng_posix-module.html#open_rng_device,Function paramiko.rng_win32.open_rng_device()=paramiko.rng_win32-module.html#open_rng_device"><a title="paramiko.rng_posix.open_rng_device -paramiko.rng_win32.open_rng_device" class="py-name" href="#" onclick="return doclink('link-5', 'open_rng_device', 'link-5');">open_rng_device</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"><tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt> -<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"> <tt class="py-comment"># Assume POSIX (any system where /dev/urandom exists)</tt> </tt> -<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt id="link-6" class="py-name"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-6', 'paramiko', 'link-1');">paramiko</a></tt> <tt class="py-keyword">import</tt> <tt id="link-7" class="py-name" targets="Module paramiko.rng_posix=paramiko.rng_posix-module.html"><a title="paramiko.rng_posix" class="py-name" href="#" onclick="return doclink('link-7', 'rng_posix', 'link-7');">rng_posix</a></tt> </tt> -<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"> <tt id="link-8" class="py-name"><a title="paramiko.rng.rng_device" class="py-name" href="#" onclick="return doclink('link-8', 'rng_device', 'link-3');">rng_device</a></tt> <tt class="py-op">=</tt> <tt id="link-9" class="py-name"><a title="paramiko.rng_posix" class="py-name" href="#" onclick="return doclink('link-9', 'rng_posix', 'link-7');">rng_posix</a></tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="paramiko.rng_posix.open_rng_device -paramiko.rng_win32.open_rng_device" class="py-name" href="#" onclick="return doclink('link-10', 'open_rng_device', 'link-5');">open_rng_device</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> </tt> -<a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool"></a><div id="StrongLockingRandomPool-def"><a name="L55"></a><tt class="py-lineno"> 55</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool-toggle" onclick="return toggle('StrongLockingRandomPool');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html">StrongLockingRandomPool</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="StrongLockingRandomPool-expanded"><a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-docstring">"""Wrapper around RandomPool guaranteeing strong random numbers.</tt> </tt> -<a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> -<a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"><tt class="py-docstring"> Crypto.Util.randpool.RandomPool will silently operate even if it is seeded</tt> </tt> -<a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"><tt class="py-docstring"> with little or no entropy, and it provides no prediction resistance if its</tt> </tt> -<a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"><tt class="py-docstring"> state is ever compromised throughout its runtime. It is also not thread-safe.</tt> </tt> -<a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> -<a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"><tt class="py-docstring"> This wrapper augments RandomPool by XORing its output with random bits from</tt> </tt> -<a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"><tt class="py-docstring"> the operating system, and by controlling access to the underlying</tt> </tt> -<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"><tt class="py-docstring"> RandomPool using an exclusive lock.</tt> </tt> -<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> -<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool.__init__"></a><div id="StrongLockingRandomPool.__init__-def"><a name="L67"></a><tt class="py-lineno"> 67</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool.__init__-toggle" onclick="return toggle('StrongLockingRandomPool.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">instance</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="StrongLockingRandomPool.__init__-expanded"><a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">instance</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> -<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"> <tt class="py-name">instance</tt> <tt class="py-op">=</tt> <tt class="py-name">_RandomPool</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-11', 'randpool', 'link-0');">randpool</a></tt> <tt class="py-op">=</tt> <tt class="py-name">instance</tt> </tt> -<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt> <tt class="py-op">=</tt> <tt class="py-name">threading</tt><tt class="py-op">.</tt><tt class="py-name">Lock</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt> <tt class="py-op">=</tt> <tt id="link-12" class="py-name"><a title="paramiko.rng.rng_device" class="py-name" href="#" onclick="return doclink('link-12', 'rng_device', 'link-3');">rng_device</a></tt> </tt> -<a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> </tt> -<a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> <tt class="py-comment"># Stir 256 bits of entropy from the RNG device into the RandomPool.</tt> </tt> -<a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-13', 'randpool', 'link-0');">randpool</a></tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Method paramiko.rng.StrongLockingRandomPool.stir()=paramiko.rng.StrongLockingRandomPool-class.html#stir"><a title="paramiko.rng.StrongLockingRandomPool.stir" class="py-name" href="#" onclick="return doclink('link-14', 'stir', 'link-14');">stir</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Method paramiko.BufferedFile.read()=paramiko.BufferedFile-class.html#read,Method paramiko.SFTPHandle.read()=paramiko.SFTPHandle-class.html#read,Method paramiko.buffered_pipe.BufferedPipe.read()=paramiko.buffered_pipe.BufferedPipe-class.html#read"><a title="paramiko.BufferedFile.read -paramiko.SFTPHandle.read -paramiko.buffered_pipe.BufferedPipe.read" class="py-name" href="#" onclick="return doclink('link-15', 'read', 'link-15');">read</a></tt><tt class="py-op">(</tt><tt class="py-number">32</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> -<a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Method paramiko.rng.StrongLockingRandomPool.randomize()=paramiko.rng.StrongLockingRandomPool-class.html#randomize"><a title="paramiko.rng.StrongLockingRandomPool.randomize" class="py-name" href="#" onclick="return doclink('link-16', 'randomize', 'link-16');">randomize</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -</div><a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool.stir"></a><div id="StrongLockingRandomPool.stir-def"><a name="L78"></a><tt class="py-lineno"> 78</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool.stir-toggle" onclick="return toggle('StrongLockingRandomPool.stir');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html#stir">stir</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">s</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool.stir-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="StrongLockingRandomPool.stir-expanded"><a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">acquire</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> -<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-17', 'randpool', 'link-0');">randpool</a></tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="paramiko.rng.StrongLockingRandomPool.stir" class="py-name" href="#" onclick="return doclink('link-18', 'stir', 'link-14');">stir</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt> -<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt> -<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">release</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="paramiko.rng.StrongLockingRandomPool.randomize" class="py-name" href="#" onclick="return doclink('link-19', 'randomize', 'link-16');">randomize</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -</div><a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool.randomize"></a><div id="StrongLockingRandomPool.randomize-def"><a name="L86"></a><tt class="py-lineno"> 86</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool.randomize-toggle" onclick="return toggle('StrongLockingRandomPool.randomize');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html#randomize">randomize</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">N</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool.randomize-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="StrongLockingRandomPool.randomize-expanded"><a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">acquire</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> -<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-20', 'randpool', 'link-0');">randpool</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="paramiko.rng.StrongLockingRandomPool.randomize" class="py-name" href="#" onclick="return doclink('link-21', 'randomize', 'link-16');">randomize</a></tt><tt class="py-op">(</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt> -<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt> -<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">release</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="paramiko.rng.StrongLockingRandomPool.randomize" class="py-name" href="#" onclick="return doclink('link-22', 'randomize', 'link-16');">randomize</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -</div><a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool.add_event"></a><div id="StrongLockingRandomPool.add_event-def"><a name="L94"></a><tt class="py-lineno"> 94</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool.add_event-toggle" onclick="return toggle('StrongLockingRandomPool.add_event');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html#add_event">add_event</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">s</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool.add_event-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="StrongLockingRandomPool.add_event-expanded"><a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">acquire</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> -<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-23', 'randpool', 'link-0');">randpool</a></tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method paramiko.rng.StrongLockingRandomPool.add_event()=paramiko.rng.StrongLockingRandomPool-class.html#add_event"><a title="paramiko.rng.StrongLockingRandomPool.add_event" class="py-name" href="#" onclick="return doclink('link-24', 'add_event', 'link-24');">add_event</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt> -<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt> -<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">release</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -</div><a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> </tt> -<a name="StrongLockingRandomPool.get_bytes"></a><div id="StrongLockingRandomPool.get_bytes-def"><a name="L101"></a><tt class="py-lineno">101</tt> <a class="py-toggle" href="#" id="StrongLockingRandomPool.get_bytes-toggle" onclick="return toggle('StrongLockingRandomPool.get_bytes');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.rng.StrongLockingRandomPool-class.html#get_bytes">get_bytes</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">N</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> -</div><div id="StrongLockingRandomPool.get_bytes-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="StrongLockingRandomPool.get_bytes-expanded"><a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">acquire</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> -<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-name">randpool_data</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="paramiko.auth_handler.randpool -paramiko.channel.randpool -paramiko.client.randpool -paramiko.common.randpool -paramiko.dsskey.randpool -paramiko.hostkeys.randpool -paramiko.kex_gex.randpool -paramiko.kex_group1.randpool -paramiko.packet.randpool -paramiko.pkey.randpool -paramiko.rsakey.randpool -paramiko.server.randpool -paramiko.sftp.randpool -paramiko.sftp_attr.randpool -paramiko.sftp_client.randpool -paramiko.sftp_file.randpool -paramiko.sftp_handle.randpool -paramiko.sftp_server.randpool -paramiko.sftp_si.randpool -paramiko.transport.randpool -paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-25', 'randpool', 'link-0');">randpool</a></tt><tt class="py-op">.</tt><tt id="link-26" class="py-name" targets="Method paramiko.Message.get_bytes()=paramiko.Message-class.html#get_bytes,Method paramiko.rng.StrongLockingRandomPool.get_bytes()=paramiko.rng.StrongLockingRandomPool-class.html#get_bytes"><a title="paramiko.Message.get_bytes -paramiko.rng.StrongLockingRandomPool.get_bytes" class="py-name" href="#" onclick="return doclink('link-26', 'get_bytes', 'link-26');">get_bytes</a></tt><tt class="py-op">(</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt> -<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt> -<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">randpool_lock</tt><tt class="py-op">.</tt><tt class="py-name">release</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> -<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-name">entropy_data</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">entropy</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="paramiko.BufferedFile.read -paramiko.SFTPHandle.read -paramiko.buffered_pipe.BufferedPipe.read" class="py-name" href="#" onclick="return doclink('link-27', 'read', 'link-15');">read</a></tt><tt class="py-op">(</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt> -<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">_strxor</tt><tt class="py-op">(</tt><tt class="py-name">randpool_data</tt><tt class="py-op">,</tt> <tt class="py-name">entropy_data</tt><tt class="py-op">)</tt> </tt> -<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-keyword">assert</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">randpool_data</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-name">N</tt> <tt class="py-keyword">and</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">entropy_data</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-name">N</tt> <tt class="py-keyword">and</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-name">N</tt> </tt> -<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt> -</div></div><a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> </tt> -<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"><tt class="py-comment"># vim:set ts=4 sw=4 sts=4 expandtab:</tt> </tt> -<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> </tt><script type="text/javascript"> -<!-- -expandto(location.href); -// --> -</script> -</pre> -<br /> -<!-- ==================== NAVIGATION BAR ==================== --> -<table class="navbar" border="0" width="100%" cellpadding="0" - bgcolor="#a0c0ff" cellspacing="0"> - <tr valign="middle"> - <!-- Home link --> - <th> <a - href="paramiko-module.html">Home</a> </th> - - <!-- Tree link --> - <th> <a - href="module-tree.html">Trees</a> </th> - - <!-- Index link --> - <th> <a - href="identifier-index.html">Indices</a> </th> - - <!-- Help link --> - <th> <a - href="help.html">Help</a> </th> - - <th class="navbar" width="100%"></th> - </tr> -</table> -<table border="0" cellpadding="0" cellspacing="0" width="100%%"> - <tr> - <td align="left" class="footer"> - Generated by Epydoc 3.0.1 on Sun Nov 1 22:14:17 2009 - </td> - <td align="right" class="footer"> - <a target="mainFrame" href="http://epydoc.sourceforge.net" - >http://epydoc.sourceforge.net</a> - </td> - </tr> -</table> - -<script type="text/javascript"> - <!-- - // Private objects are initially displayed (because if - // javascript is turned off then we want them to be - // visible); but by default, we want to hide them. So hide - // them unless we have a cookie that says to show them. - checkCookie(); - // --> -</script> -</body> -</html> |