How deterministic Are .Net GUIDs?

后端 未结 6 1475
甜味超标
甜味超标 2021-02-04 09:14

Yesterday I asked Are GUIDs generated on Windows 2003 safe to use as session IDs? and the answer combined with combined with this article GUIDs are globally unique, but substrin

6条回答
  •  Happy的楠姐
    2021-02-04 09:57

    I suggest you use the System.Security.Cryptography.RandomNumberGenerator. This is designed to produce numbers which can't be reverse engineered. Guid's motivation is to be unique. You could combine both the GUID and secure random number, but a 128 bit secure random number is never going to have a collision on practice.

提交回复
热议问题