aes_decryptor.py 文件源码

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

项目:wizard 作者: honor100 项目源码 文件源码
def encrypt(self,text):
        cryptor = AES.new(self.key,self.mode,b'0000000000000000')
        #????key ?????16?AES-128?,
        #24?AES-192?,??32 ?AES-256?Bytes ??
        #??AES-128 ??????
        length = 16
        count = len(text)
        if count < length:
            add = (length-count)
            #\0 backspace
            text = text + ('\0' * add)
        elif count > length:
            add = (length-(count % length))
            text = text + ('\0' * add)
        self.ciphertext = cryptor.encrypt(text)
        #??AES??????????????ascii??????????????????????
        #?????????????????16?????
        return b2a_hex(self.ciphertext)

    #????????????strip() ??
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号