def encrypt_sng(data, key):
header = Int32ul.build(74) + Int32ul.build(3)
iv = bytes(16)
payload = Int32ul.build(len(data))
payload += zlib.compress(data, zlib.Z_BEST_COMPRESSION)
encrypted = aes_sng(key, iv).encrypt(pad(payload))[:len(payload)]
return header + iv + encrypted + bytes(56)
评论列表
文章目录