We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91bf921 commit ff3a7adCopy full SHA for ff3a7ad
tests/unit/test_secret.py
@@ -20,3 +20,23 @@ def test_secret(self):
20
clear3 = box.decrypt(ctxt2)
21
self.assertEqual(clear3, msg)
22
23
+ def test_unicode_issues(self):
24
+ msg = u'Unicode string'
25
+ box = libnacl.secret.SecretBox()
26
+
27
+ # Encrypting a unicode string (in py2) should
28
+ # probable assert, but instead it encryptes zeros,
29
+ # perhaps the high bytes in UCS-16?
30
+ ctxt = box.encrypt(msg)
31
+ self.assertNotEqual(msg, ctxt)
32
33
+ box2 = libnacl.secret.SecretBox(box.sk)
34
+ clear1 = box.decrypt(ctxt)
35
36
+ self.assertEqual(msg, clear1)
37
+ clear2 = box2.decrypt(ctxt)
38
39
+ self.assertEqual(clear1, clear2)
40
+ ctxt2 = box2.encrypt(msg)
41
+ clear3 = box.decrypt(ctxt2)
42
+ self.assertEqual(clear3, msg)
0 commit comments