1
2
3
4 """Miscellaneous functions to mask Python version differences."""
5
6 import sys
7 import os
8 import math
9
10
11 from hashlib import md5
12 from hashlib import sha1
13
14
18 return bytearray(howMany)
19
23 bytes = bytearray(s)
24 return bytes
25
27 if n==0:
28 return 0
29 s = "%x" % n
30 return ((len(s)-1)*4) + \
31 {'0':0, '1':1, '2':2, '3':2,
32 '4':3, '5':3, '6':3, '7':3,
33 '8':4, '9':4, 'a':4, 'b':4,
34 'c':4, 'd':4, 'e':4, 'f':4,
35 }[s[0]]
36 return int(math.floor(math.log(n, 2))+1)
37
38 import traceback
42