示例#1
0
文件: test.py 项目: david415/pynacl-1
 def test_secretbox(self):
     nonce = nacl.randombytes(nacl.crypto_secretbox_NONCEBYTES)
     c = nacl.crypto_secretbox(self.msg, nonce, self.k)
     m = nacl.crypto_secretbox_open(c, nonce, self.k)
     self.assertEqual(m, self.msg)
示例#2
0
 def test_secretbox(self):
     nonce = nacl.randombytes(nacl.crypto_secretbox_NONCEBYTES)
     c = nacl.crypto_secretbox(self.msg, nonce, self.k)
     m = nacl.crypto_secretbox_open(c, nonce, self.k)
     self.assertEqual(m, self.msg)
示例#3
0
文件: crypto.py 项目: rep/pwrcall
	def decrypt_nacl(data, secret):
		n, data = data[:nacl.crypto_secretbox_NONCEBYTES], data[nacl.crypto_secretbox_NONCEBYTES:]
		return nacl.crypto_secretbox_open(data, n, secret)