示例#1
0
文件: test_security.py 项目: rec/xled
 def test_invalid_key_none(self):
     if is_py3:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     else:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     with self.assertRaises(TypeError):
         security.xor_strings(mac_packed, None)
示例#2
0
文件: test_security.py 项目: rec/xled
 def test_short_plus_one(self):
     if is_py3:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     else:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     cipher = security.xor_strings(mac_packed, b"\x01")
     assert b']\xce~\xa0"J' == cipher
示例#3
0
文件: test_security.py 项目: rec/xled
 def test_short_identity(self):
     if is_py3:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     else:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     cipher = security.xor_strings(mac_packed, b"\x00")
     assert mac_packed == cipher
示例#4
0
文件: test_security.py 项目: rec/xled
 def test_identity(self):
     if is_py3:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     else:
         mac_packed = b"\\\xcf\x7f\xa1#K"
     key = b"\x00" * len(mac_packed)
     cipher = security.xor_strings(mac_packed, key)
     assert mac_packed == cipher
示例#5
0
文件: test_security.py 项目: rec/xled
 def test_invalid_both_none(self):
     with self.assertRaises(TypeError):
         security.xor_strings(None, None)
示例#6
0
文件: test_security.py 项目: rec/xled
 def test_invalid_message_none(self):
     with self.assertRaises(TypeError):
         security.xor_strings(None, b"\x01")