English 中文(简体)
《儿童权利公约》32 一切可能的ASCII系列研究的碰撞概率,从1到7年不等
原标题:What is the CRC32 Collision probability of All possible ASCII strings of variable length ranging from 1 to 7

我正试图找到所有可能的ASCII系列星号之间可能发生碰撞的概率,从1到7不等。 在这里,ASCII特性从ASCII 32到ASCII。 我试图在我的常设仲裁法院执行我的方案,但由于万国邮联的高要求,该方案将坠毁,永远无法完成。 是否有其他办法可以发现这一点。

我的法典如下:

import binascii
from itertools import product

def crc32_all_ascii_strings(length):
  strings = []
  for chars in product(range(32, 127), repeat=length):
    strings.append(  .join(chr(c) for c in chars))

  crc32_dict = {}
  for string in strings:
    crc32 = binascii.crc32(string.encode()) & 0xFFFFFFFF
    if crc32 not in crc32_dict:
      crc32_dict[crc32] = []
    crc32_dict[crc32].append(string)

  return crc32_dict

if __name__ == "__main__":
  for length in range(1, 8):
    crc32_dict = crc32_all_ascii_strings(length)
    for crc32, string_list in crc32_dict.items():
      if len(string_list) > 1:
        print(f"CRC32: {crc32:08X}")
        for string in string_list:
          print(f"  {string}")
最佳回答

The probability of collision for strings of length 1-4 is exactly zero. A CRC-32 is a one-to-one and onto mapping of 32 bits to 32 bits.

就5年而言,碰撞概率非常接近2-32. 95 5是2倍32,因此对范围空间的覆盖面很广。 6年或6年以上,几乎完全是2年<>-32>,无论是ASCII还是所有随附价值。 领域制约因素的影响微不足道。

Update:

我进行了试验,长度为5,将5个 by限制在32.126,碰撞概率约为2-31.5。 这一数字比tes(0.255)的碰撞概率高出40%,即2-32

就长度6而言,在32.126中,我们确实有2个-32的碰撞概率。 更长时间不变。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签