Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsodium.py
More file actions
Latest commit
25 lines (17 loc) · 823 Bytes
/
Copy pathsodium.py
File metadata and controls
25 lines (17 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
importos
importbase64
importpysodiumass
fromAuthwave.Cipher.EncryptedMessageimportEncryptedMessage
fromAuthwave.Cipher.PlainTextMessageimportPlainTextMessage
fromAuthwave.Cipher.KeyimportKey
sharedKey=Key()
message=PlainTextMessage("This is the test message @~::>>>?>><<")
print("Message to send: "+str(message))
cipherText=message.encrypt(sharedKey)
print("Shared Key: "+str(base64.b64encode(sharedKey.getBytes())))
print("IV: "+str(base64.b64encode(message.getIv().getBytes())))
print("Cipher: "+str(base64.b64encode(cipherText.getBytes())))
encryptedMessage=EncryptedMessage(base64.b64encode(cipherText.getBytes()), message.getIv())
decryptedMessage=encryptedMessage.decrypt(sharedKey)
print(str(decryptedMessage))
print(cipherText.getQueryString("https://cipher-test.g105b.com"))