Skip to content

Instantly share code, notes, and snippets.

@shshemi
Last active March 27, 2020 14:29
Show Gist options
  • Save shshemi/3169b5efe61e20d8c4bae75465bf1c21 to your computer and use it in GitHub Desktop.
Save shshemi/3169b5efe61e20d8c4bae75465bf1c21 to your computer and use it in GitHub Desktop.
def ascii_encode(message, sentence_len):
sen = np.zeros((1, sentence_len))
for i, a in enumerate(message.encode("ascii")):
sen[0, i] = a
return sen
def ascii_decode(message):
return ''.join(chr(int(a)) for a in message[0].argmax(-1))
Copy link

ghost commented Mar 26, 2020

Where it excute the codes

Copy link

ghost commented Mar 26, 2020

For this code what kind of libraries need to used for this

@shshemi
Copy link
Author

shshemi commented Mar 27, 2020

Where it excute the codes

This code is a part of the article "Neural Cryptography" the article could be found here. Furthermore, the code for it may be found here.
I hope you got your answers.

Copy link

ghost commented Mar 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment