Hey Guys
I've got a Python function that is slowing the efficiency of my program down and was wondering if anyone could give me some pointers on how I could make this function more efficient ?
The function is used for converting a integer to a base 16 number.
def IntToNBytes(integer, n):
tmphex = hex(integer)[2:]
while len(tmphex)<2*n:
tmphex = '0'+tmphex
tmpbyte = []
j = 0
for i in range(n):
tmpbyte.append(int(tmphex[j], 16)*16+int(tmphex[j+1], 16))
j = j+2
return tmpbyte