使用密钥来重新排列串 [英] using a key to rearrange string
本文介绍了使用密钥来重新排列串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Python欲的随机的重新排列基于给定键的字符串的部分。我也想恢复使用相同的密钥的原始字符串:
Using Python I want to randomly rearrange sections of a string based on a given key. I also want to restore the original string with the same key:
def rearrange(key, data):
pass
def restore(key, rearranged_data):
pass
效率并不重要。任何想法?
Efficiency is not important. Any ideas?
编辑:
- 可以假定密钥哈希的,而可以是多种类型
- 部分的伊格纳西奥 定义
- can assume key is hashable, but may be multiple types
- definition of section for ignacio
推荐答案
您可以推倒重来,但为什么不尝试一下加密库第一,如果可能的话。
you can reinvent the wheel, but why not try an encryption library first, if possible.
这篇关于使用密钥来重新排列串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文