-1

I am writing a Skype-like program. Obviously, I need to encrypt every single message before it is sent to the server, but in order to do that, I need it to be translated into machine code. But do I do that in Python? When I try to use encode, all I get is "b' the string I have encoded'". But what I need would be '00000001 00000010 ...' so that I can work with machine code directly for better encryption. Thanks.

Tejas Thakar
  • 585
  • 5
  • 19
Alex Walker
  • 91
  • 2
  • 9
  • Possible duplicate of [Convert string to binary in python](https://stackoverflow.com/questions/18815820/convert-string-to-binary-in-python) – Harshith Thota Jul 10 '17 at 11:15

1 Answers1

0
st = 'Plain string'
l = list(st)
t = ''
for x in l:
   t+= format(ord(x),'b')
print(t)
Harshith Thota
  • 856
  • 8
  • 20