makepass.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:MakePass 作者: Lucretiel 项目源码 文件源码
def sampled_entropy(sample_size, success_size):
    '''
    Estimate the change in entropy given a sample of passwords from a set.

    Rationalle: Assume that we can produce passwords with a known entropy.
    However, not all of these passwords are at least 24 characters long. Rather
    than try to calculate the exact change in entropy, we estimate it by
    generating {sample_size} passwords, and seeing that {success_size} meet our
    constraints. We then assume that the ratio of these numbers is proportional
    to the overall ratio of possible_passwords to allowed_passwords. This
    allows us to do the following caluclation:

    original_entropy = log2(permutation_space)
    new_entropy = log2(permutation_space * ratio)
        = log2(permutation_space) + log2(ratio)
        = log2(permutation_space) + log2(success_size / sample_size)
        = log2(permutation_space) + log2(success_size) - log2(sample_size)
        = original_entropy + log2(success_size) - log2(sample_size)
    '''
    return log2(success_size) - log2(sample_size)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号