What is the probability of guessing (matching) a Guid?

前端 未结 6 783
后悔当初
后悔当初 2020-12-15 21:55

Just curious but what is the probability of matching a Guid?

Say a Guid from SQL server: 5AC7E650-CFC3-4534-803C-E7E5BBE29B3D

is it a factorial?: (36*32)! =

6条回答
  •  别那么骄傲
    2020-12-15 22:45

    There are a number of things wrong with your calculations. First off, 36*32 implies that any alphanumeric character can be part of the GUID. This is not the case; only HEX characters are allowed.

    Secondly, the calculation for the number of unique GUIDs is Number of Valid Characters (16: 0-9, A-F) ^ length of GUID (32 characters )

    So we have 16^32 ==> 2^(4^32) ==> 2^128

    The odds of guessing any one GUID is 1 / 2^128.

提交回复
热议问题