简体   繁体   English

如何在一个范围内生成每个可能的整数,而不会从同样可逆的种子中重复

[英]How can I generate every possible integer in a range without repeats from a seeds that is also reversible

I have been looking for a while at large number generation through seeds and I've struggled to find what I am looking for due to how specific it is.我一直在通过种子寻找大量的世代,但由于它的具体性,我一直在努力寻找我正在寻找的东西。 I think the main thing that is causing the problems is the size of numbers I want to generate, for example... I want to have it so that I can generate every single number that is 5000 digits long through some form of seed or selective input process.我认为导致问题的主要原因是我想要生成的数字的大小,例如......我想要它,这样我就可以通过某种形式的种子或选择性生成每个 5000 位长的数字输入过程。 The other problem being that I would like to be able to reverse the process to know how I got there.另一个问题是我希望能够扭转这个过程以了解我是如何到达那里的。 If I have this number I want to know what inputs or what seed would generate this.如果我有这个数字,我想知道什么输入或什么种子会产生这个数字。 Hope this makes sense and I understand this is a extremely specific question.希望这是有道理的,我知道这是一个非常具体的问题。

For a problem like this I would use an encryption.对于这样的问题,我会使用加密。 Since encryption is a one-to-one process provided you use unique inputs, and keep the same key, then the outputs are guaranteed unique.由于加密是一个一对一的过程,只要您使用唯一的输入并保持相同的密钥,那么输出就可以保证是唯一的。 for unique inputs, encrypt the numbers 0, 1, 2, 3, ... You will need to extend the inputs by adding leading zeros so they are the size you need, enough for the binary equivalent of 5,000 decimal digits.对于唯一输入,加密数字 0、1、2、3,... 您需要通过添加前导零来扩展输入,使其达到您需要的大小,足以满足 5,000 个十进制数字的二进制等价物。

The output from the encryption will be the same size.加密的输出将是相同的大小。 Just convert the binary output back into the equivalent decimal number.只需将二进制输出转换回等效的十进制数。 There may be a few boundary cases just over the limit where the decimal and binary boundaries;可能有一些边界情况刚好超过十进制和二进制边界的限制; in those cases just re-encrypt until the result is within the set limit.在这些情况下,只需重新加密,直到结果在设定的限制内。 This is the cycle walking technique from Format Preserving encryption.这是来自 Format Preserving 加密的循环行走技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用可逆种子制作所有可能的列表组合? - How can I make all possible list combinations using reversible seeds? 如何生成范围内所有可能排列的列表 - How can I generate a list of all possible permutations in range 如何从成对列表中生成每个组组合? - How can I generate every combination of groups from a list of pairs? 我如何从 0.0.0.0/0 范围内生成随机 ips - How can i generate random ips from 0.0.0.0/0 range 如何从另一个向量(作为种子)生成一个伪随机数向量? - How to generate a vector of pseudo random numbers from another vector (as seeds)? 我如何向我的代码添加一些东西,以便在它添加到列表时不会每 6 次重复一次? - How can I add something to my code so there are no repeats every 6 times when it adds to a list? 如何创建一个将每个数字重复两次的数组? - How do I create an array that repeats every number twice? 我可以编译一个不可逆的 python 代码吗? - Can I compile a python code so that is not reversible? 如何在Python的字典的每个值中添加/减去一个整数? - How can I add/substract an integer to every value of an dictionary in Python? 如何检查字典中的第二个值是否在特定范围内? - How can I check whether every second value from a dictionary is in a specific range?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM