生成移位字符组合所需的算法

发布于 2024-10-01 04:07:55 字数 206 浏览 0 评论 0原文

我知道 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

情丝乱 2024-10-08 04:07:55

由于每个字符可以是大写或小写,因此相当于一位。你有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!

作业与我同在 2024-10-08 04:07:55

假设您必须尝试所有组合,并且每次密码尝试均由单个字符分隔,则 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).

做个少女永远怀春 2024-10-08 04:07:55

快速 python 脚本:

def isShiftable(c):
    return not c in "123456789"

def generate(str, i=0):
    if len(str) <= i:
        print "".join(str)
    else:
        if isShiftable(str[i]):
            str[i]=str[i].upper()
            generate(str, i+1)
            str[i]=str[i].lower()
            generate(str, i+1)
        else:
            generate(str, i+1)

generate(list("testit123"))

我确信它可以被清理,并且变得不那么糟糕,但它应该足够了。

对于 17 个可移动字符,应该有 131072 种可能性。此外,您还需要定义自己的“上”/“下”函数来移动标点符号。

Quick python script:

def isShiftable(c):
    return not c in "123456789"

def generate(str, i=0):
    if len(str) <= i:
        print "".join(str)
    else:
        if isShiftable(str[i]):
            str[i]=str[i].upper()
            generate(str, i+1)
            str[i]=str[i].lower()
            generate(str, i+1)
        else:
            generate(str, i+1)

generate(list("testit123"))

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.

怪我闹别瞎闹 2024-10-08 04:07:55

不是真正的答案,但它可能会减少您的搜索空间:

  • 大写字母的最小和最大序列(可能是 4 和 10)
  • 大写字母的最小和最大序列(也可能是 1 和 1)
  • 小写字母的最小和最大序列(可能是 2 和15)
  • 某些组合比其他组合更有可能出现,应首先检查。例如,按最大大写序列对组合进行分组,并首先检查具有最小此类值的组合。

Not really an answer but it might reduce your search space:

  • Minimum and maximum of uppercase (could be 4 and 10)
  • Minimum and maximum sequence of uppercase (could as well be 1 and 1)
  • Minimum and maximum sequence of lowercase (could be 2 and 15)
  • Some combinations are more probable than the others, and should be checked first. For instance group combinations by maximum sequence of uppercase and first check those with minimal such value.
耳根太软 2024-10-08 04:07:55

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:

  • If you had 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.
  • If you had 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:

  • If you had 7 > x uppercase letters, it would take: 51.84 minutes
  • If you had 6 < x < 9 uppercase letters, it would take: 20.14 hours

Most 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文