tags:

views:

75

answers:

1

I wanted to make my own encryption algorithm and decryption algorithm , encryption algorithm works fine and converts ascii value of the characters into alternate hexadecimal and octal representations. But when I tried decryption, problem occured as it return int('0671') = 671, as 0671 is string type in the following code. Is there a method to convert "ox56" into integer form??????

NOTE: Following string is alternate octal and hexa of ascii value of char.

///////////////DECRYPTION///////

l="01630x7401620x6901560x67"
f=len(l)
k=0
d=0
x=[]

for i in range(0,f,4):
  g=l[i:i+4]
  print g 
  k=k+1   
  if(k%2==0):
  p=g
  print p
  else:
  p=int(g)
  print p
+2  A: 

there you go (s is the string)

int(s,0)
fortran
Thanks a lot , I am tyro in python it works
Harshit Sharma