diff options
author | Jeremy T. Bouse <jbouse@debian.org> | 2015-03-12 21:35:58 -0400 |
---|---|---|
committer | Jeremy T. Bouse <jbouse@debian.org> | 2015-03-12 21:35:58 -0400 |
commit | f784a533d6e1d09e89dc254f3493b491e19c94f0 (patch) | |
tree | 6079fb034538b346b999a6fefcae4b1c557713c5 /paramiko/util.py | |
parent | 941814e1efaf9a46992476e50badcecbcbfc9a41 (diff) | |
download | python-paramiko-f784a533d6e1d09e89dc254f3493b491e19c94f0.tar python-paramiko-f784a533d6e1d09e89dc254f3493b491e19c94f0.tar.gz |
Imported Upstream version 1.15.2
Diffstat (limited to 'paramiko/util.py')
-rw-r--r-- | paramiko/util.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/paramiko/util.py b/paramiko/util.py index 88ca2bc..d9a29d7 100644 --- a/paramiko/util.py +++ b/paramiko/util.py @@ -23,7 +23,6 @@ Useful functions used by the rest of paramiko. from __future__ import generators import array -from binascii import hexlify, unhexlify import errno import sys import struct @@ -106,21 +105,14 @@ def format_binary_line(data): return '%-50s %s' % (left, right) -def hexify(s): - return hexlify(s).upper() - - -def unhexify(s): - return unhexlify(s) - - def safe_string(s): - out = '' + out = b('') for c in s: - if (byte_ord(c) >= 32) and (byte_ord(c) <= 127): - out += c + i = byte_ord(c) + if 32 <= i <= 127: + out += byte_chr(i) else: - out += '%%%02X' % byte_ord(c) + out += b('%%%02X' % i) return out @@ -307,9 +299,9 @@ class Counter (object): self.value = array.array('c', zero_byte * (self.blocksize - len(x)) + x) return self.value.tostring() + @classmethod def new(cls, nbits, initial_value=long(1), overflow=long(0)): return cls(nbits, initial_value=initial_value, overflow=overflow) - new = classmethod(new) def constant_time_bytes_eq(a, b): |