import base64
import string
import binascii

""" 
Convert the input from integer to ascii text and return it. If unsuccesfull, 
return an empty string. 
"""
def integer_to_ascii(convertable):
    try:
        return chr(int(convertable))
    except:
        return ''

""" 
Convert the input from ascii to integer and return it. If unsuccesfull, 
return an empty string. 
"""
def ascii_to_integer(convertable):
    try:
        return ord(convertable)
    except:
        try:
            numbers = []
            for i in convertable:
                numbers.append(ord(i))
            return numbers
        except:
            return ''

""" 
Convert the input from integer to hex and return it. If unsuccesfull, 
return an empty string. 
"""
def integer_to_hex(convertable):
    try:
        return hex(int(convertable))[2:]
    except:
        return ''
    
""" 
Convert the input from hex to integer and return it. If unsuccesfull, 
return an empty string. 
"""
def hex_to_integer(convertable):
    try:
        return int(convertable, 16)
    except:
        return ''

""" 
Convert the input from ascii text to hex and return it. If unsuccesfull, 
return an empty string. 
"""
def ascii_to_hex(convertable):
    try:
        return convertable.encode('hex')
    except:
        return ''
   
""" 
Convert the input from hex to ascii text and return it. If unsuccesfull, 
return an empty string. 
""" 
def hex_to_ascii(convertable):
    try:
        return convertable.decode('hex')
    except:
        return ''

""" 
Encode the input to base64 and return it. 
""" 
def encode_base64(convertable):
    return base64.b64encode(convertable)
    
""" 
Decode the input from base64 and return it. If unsuccesfull, 
return an empty string. 
""" 
def decode_base64(convertable):
    try:
        return base64.b64decode(convertable)
    except:
        return ''

""" 
Convert the input from integer to binary and return it. If unsuccesfull, 
return an empty string. 
""" 
def integer_to_binary(convertable):
    try:
        return bin(int(convertable))[2:].zfill(8)
    except:
        return ''

""" 
Convert the input from text to binary and return it. If unsuccesfull, 
return an empty string. 
""" 
def ascii_to_binary(convertable):
    try:
        return ''.join(format(ord(c), 'b').zfill(8) for c in convertable)
    except:
        return ''

""" 
Convert the input from binary to integer and return it. If unsuccesfull, 
return an empty string. 
""" 
def binary_to_int(convertable):
    try:
        return int(convertable, 2)
    except:
        return ''

""" 
Convert the input from binary to ascii text and return it. If unsuccesfull, 
return an empty string. 
""" 
def binary_to_ascii(convertable):
    result = ''
    try:
        for i in range(0, len(convertable), 8):
            result += binascii.unhexlify('%x' % int(convertable[i:i+8], 2))
        return result
    except:
        return ''
 

@@ -36,16 +36,30 @@
 binascii
+%0Aimport codecs
 %0A%0A%22%22%22 %0AC
@@ -76,31 +76,31 @@
  input from 
-integer
+decimal
  to ascii te
@@ -164,31 +164,31 @@
 g. %0A%22%22%22%0Adef 
-integer
+decimal
 _to_ascii(co
@@ -309,31 +309,31 @@
 om ascii to 
-integer
+decimal
  and return 
@@ -392,31 +392,31 @@
 ef ascii_to_
-integer
+decimal
 (convertable
@@ -672,31 +672,31 @@
  input from 
-integer
+decimal
  to hex and 
@@ -753,31 +753,31 @@
 g. %0A%22%22%22%0Adef 
-integer
+decimal
 _to_hex(conv
@@ -902,31 +902,31 @@
 from hex to 
-integer
+decimal
  and return 
@@ -987,23 +987,23 @@
  hex_to_
-integer
+decimal
 (convert
@@ -1233,38 +1233,45 @@
    try:%0A        
-return
+convertable =
  convertable.enc
@@ -1271,27 +1271,94 @@
 ble.encode('
-hex
+ascii')%0A        return codecs.encode(convertable, 'hex').decode('ascii
 ')%0A    excep
@@ -1378,19 +1378,16 @@
 turn ''%0A
-   
 %0A%22%22%22 %0ACo
@@ -1543,16 +1543,30 @@
  return 
+codecs.decode(
 converta
@@ -1568,16 +1568,24 @@
 vertable
+, 'hex')
 .decode(
@@ -1585,19 +1585,21 @@
 decode('
-hex
+ascii
 ')%0A    e
@@ -1705,24 +1705,37 @@
 nvertable):%0A
+    try:%0A    
     return b
@@ -1757,24 +1757,119 @@
 (convertable
+.encode()).decode()%0A    except AttributeError:%0A        return base64.b64encode(str(convertable)
 )%0A    %0A%22%22%22 %0A
@@ -2037,32 +2037,48 @@
 ode(convertable)
+.decode('ascii')
 %0A    except:%0A   
@@ -2121,23 +2121,23 @@
 ut from 
-integer
+decimal
  to bina
@@ -2206,23 +2206,23 @@
 %22%22 %0Adef 
-integer
+decimal
 _to_bina
@@ -2624,15 +2624,15 @@
  to 
-integer
+decimal
  and
@@ -2705,19 +2705,23 @@
 nary_to_
-int
+decimal
 (convert
@@ -2961,16 +2961,17 @@
 esult = 
+b
 ''%0A    t
@@ -3119,16 +3119,32 @@
 n result
+.decode('ascii')
 %0A    exc

Update convert.py