~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/python/hashlib.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- test-case-name: twisted.python.test.test_hashlib -*-
 
2
# Copyright (c) 2008 Twisted Matrix Laboratories.
 
3
# See LICENSE for details.
 
4
 
 
5
"""
 
6
L{twisted.python.hashlib} presents a subset of the interface provided by
 
7
U{hashlib<http://docs.python.org/library/hashlib.html>}.  The subset is the
 
8
interface required by various parts of Twisted.  This allows application code
 
9
to transparently use APIs which existed before C{hashlib} was introduced or to
 
10
use C{hashlib} if it is available.
 
11
"""
 
12
 
 
13
 
 
14
try:
 
15
    _hashlib = __import__("hashlib")
 
16
except ImportError:
 
17
    from md5 import md5
 
18
    from sha import sha as sha1
 
19
else:
 
20
    md5  = _hashlib.md5
 
21
    sha1 = _hashlib.sha1
 
22
 
 
23
 
 
24
__all__ = ["md5", "sha1"]