Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/Crypto/Random/OSRNG/__init__.py: 50%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 07:03 +0000

1# 

2# Random/OSRNG/__init__.py : Platform-independent OS RNG API 

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"""Provides a platform-independent interface to the random number generators 

25supplied by various operating systems.""" 

26 

27__revision__ = "$Id$" 

28 

29import os 

30 

31if os.name == 'posix': 

32 from Crypto.Random.OSRNG.posix import new 

33elif os.name == 'nt': 

34 from Crypto.Random.OSRNG.nt import new 

35elif hasattr(os, 'urandom'): 

36 from Crypto.Random.OSRNG.fallback import new 

37else: 

38 raise ImportError("Not implemented") 

39 

40# vim:set ts=4 sw=4 sts=4 expandtab: