birthday-paradox

Can someone please clarify the Birthday Effect for me?

时间秒杀一切 提交于 2019-12-05 09:37:51
Please help interpret the Birthday effect as described in Wikipedia: A birthday attack works as follows: Pick any message m and compute h(m). Update list L. Check if h(m) is in the list L. if (h(m),m) is already in L, a colliding message pair has been found. else save the pair (h(m),m) in the list L and go back to step 1. From the birthday paradox we know that we can expect to find a matching entry, after performing about 2^(n/2) hash evaluations. Does the above mean 2^(n/2) iterations through the above entire loop (i.e. 2^(n/2) returns to step 1), OR does it mean 2^(n/2) comparisons to

Uniquely identifying URLs with one 64-bit number

那年仲夏 提交于 2019-12-03 08:22:05
This is basically a math problem, but very programing related: if I have 1 billion strings containing URLs, and I take the first 64 bits of the MD5 hash of each of them, what kind of collision frequency should I expect? How does the answer change if I only have 100 million URLs? It seems to me that collisions will be extremely rare, but these things tend to be confusing. Would I be better off using something other than MD5? Mind you, I'm not looking for security, just a good fast hash function. Also, native support in MySQL is nice. EDIT : not quite a duplicate If the first 64 bits of the MD5

Examples of Hash-Collisions?

試著忘記壹切 提交于 2019-11-28 05:23:09
For demonstration-purposes, what are a couple examples of strings that collide when hashed? MD5 is a relatively standard hashing-option, so this will be sufficient. This page provides these examples of 128 byte values hashing to the same value: d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89 55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0 e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70 and d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89

Examples of Hash-Collisions?

这一生的挚爱 提交于 2019-11-27 05:33:24
问题 For demonstration-purposes, what are a couple examples of strings that collide when hashed? MD5 is a relatively standard hashing-option, so this will be sufficient. 回答1: This page provides these examples of 128 byte values hashing to the same value: d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89 55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0 e99f33420f577ee8ce54b67080a80d1e

Random is barely random at all?

不想你离开。 提交于 2019-11-26 21:24:10
I did this to test the randomness of randint: >>> from random import randint >>> >>> uniques = [] >>> for i in range(4500): # You can see I was optimistic. ... x = randint(500, 5000) ... if x in uniques: ... raise Exception('We duped %d at iteration number %d' % (x, i)) ... uniques.append(x) ... Traceback (most recent call last): File "<stdin>", line 4, in <module> Exception: We duped 887 at iteration number 7 I tried about 10 times more and the best result I got was 121 iterations before a repeater. Is this the best sort of result you can get from the standard library?

Random is barely random at all?

折月煮酒 提交于 2019-11-26 07:55:21
问题 I did this to test the randomness of randint: >>> from random import randint >>> >>> uniques = [] >>> for i in range(4500): # You can see I was optimistic. ... x = randint(500, 5000) ... if x in uniques: ... raise Exception(\'We duped %d at iteration number %d\' % (x, i)) ... uniques.append(x) ... Traceback (most recent call last): File \"<stdin>\", line 4, in <module> Exception: We duped 887 at iteration number 7 I tried about 10 times more and the best result I got was 121 iterations before