summaryrefslogtreecommitdiff
path: root/paramiko/util.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-09-15 14:05:15 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-09-15 14:05:15 -0700
commit56a4739923a356ff5670b4620139ca55a2f30148 (patch)
tree405e2573eaacc37615607a349773d389078c31fc /paramiko/util.py
parentf74c7d76ec2ea9d39a4af6643761b648f81bd266 (diff)
downloadparamiko-56a4739923a356ff5670b4620139ca55a2f30148.tar.gz
Switched everything to use cryptography
Diffstat (limited to 'paramiko/util.py')
-rw-r--r--paramiko/util.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/paramiko/util.py b/paramiko/util.py
index d029f52e..f966099d 100644
--- a/paramiko/util.py
+++ b/paramiko/util.py
@@ -281,37 +281,6 @@ def retry_on_signal(function):
raise
-class Counter (object):
- """Stateful counter for CTR mode crypto"""
- def __init__(self, nbits, initial_value=long(1), overflow=long(0)):
- self.blocksize = nbits / 8
- self.overflow = overflow
- # start with value - 1 so we don't have to store intermediate values when counting
- # could the iv be 0?
- if initial_value == 0:
- self.value = array.array('c', max_byte * self.blocksize)
- else:
- x = deflate_long(initial_value - 1, add_sign_padding=False)
- self.value = array.array('c', zero_byte * (self.blocksize - len(x)) + x)
-
- def __call__(self):
- """Increament the counter and return the new value"""
- i = self.blocksize - 1
- while i > -1:
- c = self.value[i] = byte_chr((byte_ord(self.value[i]) + 1) % 256)
- if c != zero_byte:
- return self.value.tostring()
- i -= 1
- # counter reset
- x = deflate_long(self.overflow, add_sign_padding=False)
- self.value = array.array('c', zero_byte * (self.blocksize - len(x)) + x)
- return self.value.tostring()
-
- 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):
if len(a) != len(b):
return False