Skip to content

Instantly share code, notes, and snippets.

@alberic89
Created January 27, 2023 20:05
Show Gist options
  • Save alberic89/b06aeaa58f514b42be7e073e3f7e1899 to your computer and use it in GitHub Desktop.
Save alberic89/b06aeaa58f514b42be7e073e3f7e1899 to your computer and use it in GitHub Desktop.
import wave
string_data = input("Please enter the string to encrypt: ")
encrypted_data = bytes(string_data, 'utf-8')
# Write the encrypted data to a new audio file
new_audio_file = wave.open('tmp.wav', 'wb')
new_audio_file.setparams((1, 2, 44100, 0, 'NONE', 'NONE'))
new_audio_file.writeframes(encrypted_data)
new_audio_file.close()
f = wave.open('tmp.wav', 'rb')
string_data = f.readframes(f.getnframes())
f.close()
print(string_data.decode('utf8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment