一、原理及每步实现见文章:https://juejin.cn/post/7084242293816983589?searchId=20240321135336F4E57A424C6F2E776B59二、代码(1)来源此文章的最完整代码:# __author: Junebao # data:2020/3/9 from bitarray import bitarray class MyDES: def __init__(self): self.child_keys = [] @staticmethod def _bit_encode(s: str) -> str: """ 将字符串转换为01字符串的形式 """ return bitarray( ''.join([bin(int('1' + hex(c)[2:], 16))[3:]
Norman1z