More type conversions

This commit is contained in:
Scott Maxwell 2013-11-02 20:20:09 -07:00
parent dc58b7bcb2
commit 7d5fa50ca4
1 changed files with 2 additions and 2 deletions

View File

@ -285,10 +285,10 @@ class Counter (object):
# start with value - 1 so we don't have to store intermediate values when counting # start with value - 1 so we don't have to store intermediate values when counting
# could the iv be 0? # could the iv be 0?
if initial_value == 0: if initial_value == 0:
self.value = array.array('c', '\xFF' * self.blocksize) self.value = array.array('c', max_byte * self.blocksize)
else: else:
x = deflate_long(initial_value - 1, add_sign_padding=False) x = deflate_long(initial_value - 1, add_sign_padding=False)
self.value = array.array('c', '\x00' * (self.blocksize - len(x)) + x) self.value = array.array('c', zero_byte * (self.blocksize - len(x)) + x)
def __call__(self): def __call__(self):
"""Increament the counter and return the new value""" """Increament the counter and return the new value"""