Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/google-endpoints/Crypto/Random/OSRNG/fallback.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #
2 # Random/OSRNG/fallback.py : Fallback entropy source for systems with os.urando m
3 #
4 # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
5 #
6 # ===================================================================
7 # The contents of this file are dedicated to the public domain. To
8 # the extent that dedication to the public domain is not available,
9 # everyone is granted a worldwide, perpetual, royalty-free,
10 # non-exclusive license to exercise all rights associated with the
11 # contents of this file for any purpose whatsoever.
12 # No rights are reserved.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
22 # ===================================================================
23
24
25 __revision__ = "$Id$"
26 __all__ = ['PythonOSURandomRNG']
27
28 import os
29
30 from rng_base import BaseRNG
31
32 class PythonOSURandomRNG(BaseRNG):
33
34 name = "<os.urandom>"
35
36 def __init__(self):
37 self._read = os.urandom
38 BaseRNG.__init__(self)
39
40 def _close(self):
41 self._read = None
42
43 def new(*args, **kwargs):
44 return PythonOSURandomRNG(*args, **kwargs)
45
46 # vim:set ts=4 sw=4 sts=4 expandtab:
OLDNEW
« no previous file with comments | « third_party/google-endpoints/Crypto/Random/OSRNG/__init__.py ('k') | third_party/google-endpoints/Crypto/Random/OSRNG/nt.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698