如果我有一个字符串s='ABCDEFJHI',然后像这样分割它['ABC','DEF','JHI']。 我有一个函数encode(一些计算),它将切片字符串转换成数字。在
for example 'encode('ABC' ) gives 50 , encode('DEF') gives 33, encode('JHI') gives 10
['ABC','DEF','JHI']给出[50,33,10]。 我想做相反的情况,解码(50)给出'ABC' 我有一个想法,当我编码子字符串时,我创建一个库,然后用它的编号附加子字符串,比如:('ABC':50)(对所有子字符串都做同样的操作),稍后在解码中,我将根据编号提取子字符串。 如何在python中实现这一点?在
如果它是可逆的,我建议以相反的格式存储(50:'ABC')。同时,想象一个给定代码以前没有编码的情况。在
在您的编码函数中:
无论您在哪里使用它,请:
^{pr2}$定义函数也类似于:
使用方式如下:
^{4}$那就是为什么你要这么做,你是怎么做的,为什么你不使用某种真正的加密技术?如果不是双向加密,那么几乎可以肯定的是,您不应该在任何地方存储数据,如果是双向加密,为什么不使用与加密相反的算法来解密它呢?记住这一点。。。。。在
相关问题 更多 >
编程相关推荐