2

I'm developing an OpenSource .NET Licensing Engine. This engine use hardware id (harddisk serial number) as lock and CRC16 this value to get shorten identifier.

Example value is MAXTOR ST3100, 476300BE and CRC16 result is 3FF0

My concern is how often 2 diffrent value get same CRC16 value, or should I use CRC32 instead ?

F8R
  • 61
  • 2
  • 7

3 Answers3

6

Probability of collision between 2 items = 1 ⁄ 0x10000 = 0.00152%...

But if you have more than 2 items, see the Birthday Problem -- it gets a lot more likely:
You just need 300 items to get a 50% probability of collision.

http://www.texify.com/img/%5CLARGE%5C%21%5CLARGE%5C%21%5Cleft%281%20-%20%5Cfrac%7B0%7D%7B2%5E%7B16%7D%7D%5Cright%29%5Cleft%281%20-%20%5Cfrac%7B1%7D%7B2%5E%7B16%7D%7D%5Cright%29%5Cleft%281%20-%20%5Cfrac%7B2%7D%7B2%5E%7B16%7D%7D%5Cright%29%5Cleft%281%20-%20%5Cfrac%7B3%7D%7B2%5E%7B16%7D%7D%5Cright%29%5Ccdots%5Cleft%281%20-%20%5Cfrac%7BN%7D%7B2%5E%7B16%7D%7D%5Cright%29%3D%2050%25%20%5C%5C%20N%20%5Capprox%20300.gif

user541686
  • 205,094
  • 128
  • 528
  • 886
  • I think I should add CPU Model to this scheme and CRC16 all individual value before concating it (example 3FF0-D0D0), to higher this probability. – F8R Aug 12 '11 at 03:05
  • @F8R: For that, you need 77163 machines for a 50% chance of collision. – user541686 Aug 12 '11 at 03:25
  • Thx, I think this number quite safe for my Licensing Engine. I don't expect any software that sold over 20K license will use this Open Source project, IMHO, :D. – F8R Aug 12 '11 at 03:50
2

As CRC16 is a 16-bit value, I'd say that the chance is around 1 in 65536.

MRAB
  • 20,356
  • 6
  • 40
  • 33
  • Glad to know the number, I think this quite rare case with Hard Disk Serial Number, :D. – F8R Aug 12 '11 at 03:01
0

No hashing method generates unique values, collisions being guaranteed at some point. The closest bet based on your requirements is simply to use the harddisk serial number as-is.

Hackers will crack it easily though.

Will
  • 2,512
  • 14
  • 19
  • This value is from Hardisk serial number (HDSN), and if hacker can manipulate HDSN, using naked HDSN is useless too, :D. But I'm using RSA 2048 for license signature verification, HDSN only for locking the license into machine. – F8R Aug 12 '11 at 02:55