diff options
Diffstat (limited to 'py11')
-rw-r--r-- | py11/attributes.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py11/attributes.py b/py11/attributes.py index 32cf940..56473ad 100644 --- a/py11/attributes.py +++ b/py11/attributes.py @@ -42,7 +42,7 @@ class Attribute_CK_ULONG(Attribute): def decode(self, x): return unpack("L", x)[0] class Attribute_biginteger(Attribute): - def encode(self, x): return ("%*x" % (((x.bit_length() + 7) / 8) * 2, x)).decode("hex") + def encode(self, x): return "\x00" if x == 0 else ("%0*x" % (((x.bit_length() + 7) / 8) * 2, x)).decode("hex") def decode(self, x): return long(x.encode("hex"), 16) |