生成移位字符组合所需的算法
我知道 TrueCrypt 分区密码的确切顺序和长度,但我不记得通过 Shift 键上移了哪些字符。我编写了一个 perl 脚本(如 CrackTC),它只是尝试文件中的所有密码,但我正在寻找一种算法来快速生成密码文件。密码为 42 个字符,因此任何建议都会有所帮助。
我意识到我只需移动数字和标点符号,因此只需更改 17 个字符。
请注意,这不是一个家庭作业问题。
I know the exact sequence and length of my TrueCrypt partition's password, but I can't recall which characters are up-shifted via the Shift key. I wrote a perl script (like CrackTC) that simply tries all passwords from a file but I'm seeking an algorithm to generate the password file quickly. The password is 42 characters so any advice will be helpful.
I realized that I would only have shifted numbers and punctuation, so only 17 of the characters need to be changed.
Note this is not a homework question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
由于每个字符可以是大写或小写,因此相当于一位。你有42位。以二进制计数,并根据二进制位的模式将字符设置为大写或小写。 2的42次方是一个非常大的数!!太大了,无法用蛮力找到!祝你好运!
Since each character can be upper or lower that's equivalent to one bit. You have 42 bits. Count in binary and set the character to upper or lower case according to the pattern of the binary bits. 2 to the power 42 is a very large number!! Too large to find by brute force! Good luck!
假设您必须尝试所有组合,并且每次密码尝试均由单个字符分隔,则 42 字符密码的所有可能大写字母的密码文件的长度将为 189 TB。您可能不想直接从文件工作。
我选择的算法是二进制计数算法,但不是切换单个位,而是切换单个字符的大小写。我强烈建议使用您记住的经验规则来缩小池范围(例如:绝对有超过 5 个大写字母,并且少于 40 个大写字母)。
Assuming that you have to try all combinations, and that each password attempt is separated by a single character, the password file for all possible capitalizations of a 42 character password would be 189 terabytes in length. You probably don't want to work directly from a file.
The algorithm I would choose is a binary counting algorithm, but instead of toggling a single bit, toggle the capitalization of a single character. I would strongly suggest narrowing the pool with rules of thumb that you remember (like: Definitely had more than 5 uppercase, and fewer than 40 uppercase).
快速 python 脚本:
我确信它可以被清理,并且变得不那么糟糕,但它应该足够了。
对于 17 个可移动字符,应该有 131072 种可能性。此外,您还需要定义自己的“上”/“下”函数来移动标点符号。
Quick python script:
I'm sure it can be cleaned up, and made less bad, but it should suffice.
For 17 shiftable characters, there should be 131072 possibilities. Also, you will need to define your own 'upper'/'lower' function for shifting punctuation.
不是真正的答案,但它可能会减少您的搜索空间:
Not really an answer but it might reduce your search space:
42 个字母的密码,并且您知道这些字母,则有 2^41 个(即:
2 199 023 255 552
)唯一组合。如果您可以在 1 秒内检查其中 10m,那么您可以对其进行暴力破解 - 并且至少需要:61 小时 5 分 2 秒。您很可能不需要做那么多工作。设 x 为大写字母的数量:
7 > x
大写字母:(42!)/(6!36!)+(42!)/(5!37!)+(42!)/(4!38!)+(42!)/( 3!39!)+(42!)/(2!40!)+(42!)/(1!41!) =6 220 767
组合。6 < x < 9
个大写字母:(42!)/(8!34!)+(42!)/(7!35!) =145 008 513
组合。如果您可以自动化检查过程并在一秒钟内检查
2000
个元素,那么在最坏情况上:7 > x
大写字母,则需要: 51.84 分钟6 < x < 9
大写字母,需要:20.14 小时您很可能需要一些特殊情况的排列算法来有效地找到唯一元素。这是一个相当复杂的问题,但我没有看到任何其他方法,因为迭代 2^41 个元素是疯狂的。
42 letter password, and you know the letters, then there are 2^41 (that is:
2 199 023 255 552
) unique combinations. If you could check 10m of them in 1 second, then you could brute force it - and it would take at least: 61 hours 5 minutes 2 seconds.You most likely wont have to do that much work. Let x be the number of uppercase letters:
7 > x
uppercase letters: (42!)/(6! 36!)+(42!)/(5! 37!)+(42!)/(4! 38!)+(42!)/(3! 39!)+(42!)/(2! 40!)+(42!)/(1! 41!) =6 220 767
combinations.6 < x < 9
uppercase letters: (42!)/(8! 34!)+(42!)/(7! 35!) =145 008 513
combinations.If you can automate checking process and check
2000
elements in a second, then on worst case:7 > x
uppercase letters, it would take: 51.84 minutes6 < x < 9
uppercase letters, it would take: 20.14 hoursMost likely you need some special case permutation algorithm to efficiently find the unique elements. This is quite complex problem, but I don't see any other way, as iterating over 2^41 elements is nuts.