base.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:oejia_wx 作者: JoneXiong 项目源码 文件源码
def _encrypt(self, text, _id):
        text = to_binary(text)
        tmp_list = []
        tmp_list.append(to_binary(self.get_random_string()))
        length = struct.pack(b'I', socket.htonl(len(text)))
        tmp_list.append(length)
        tmp_list.append(text)
        tmp_list.append(to_binary(_id))

        text = b''.join(tmp_list)
        text = PKCS7Encoder.encode(text)

        ciphertext = to_binary(self.cipher.encrypt(text))
        return base64.b64encode(ciphertext)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号