Home » Android » android – How OpenUDID works

android – How OpenUDID works

Posted by: admin June 15, 2020 Leave a comment

Questions:

Do you know how OpenUDID generate unique device ID?
Is there any chance that 2 devices having the same OpenUDID value?

EDIT 1:

Will the OpenUDID change when the device is reset?

EDIT 2:

If collision is possible, is there any alternative for OpenUDID that could work better.

How to&Answers:

If only there was a way to have a look at the source code…

// Next we try to use an alternative method which uses the host name, process ID, and a time stamp
// We then hash it with md5 to get 32 bytes, and then add 4 extra random bytes
// Collision is possible of course, but unlikely and suitable for most industry needs (e.g.. aggregate tracking)

Answer:

It is essentially a 160bit random string. So there are 2^160 combinations. So it is very very unlikely to ever get two the same

Answer:

Then this really isn’t suitable for apps that use the UDID as a login identifier.. If you have to restore your device then the UDID will be different whereas Apple’s UDID is part of the actual phone and will persist restores.

This is really more like a cookie for advertisers to use .. it doesn’t HAVE to be 100% accurate then, only mostly accurate.

Answer:

According to this OpenUDID works like this:

Technically, OpenUDID uses a mix of local app storage for cache and safeguarding, as well as inter-app storage (custom pasteboards on iOS). This means that the system is decentralized, neither controlled by Apple nor anyone else. The more OpenUDID is used, the more robust and prevalent and tamper proof it gets.

Other than that, the OpenUDID looks and feels the same as the native UDID, a 40 characters long hexadecimal string. For instance:

369416e16c373b617b2e4d151e01244c748c7b3e

I hope this helps

Answer:

Read this The Developer’s Guide to Unique Identifiers

Back when iOS 5 was released and uniqueIdentifier became deprecated
there was a rush to find an alternative to the UDID that was not
controlled by Apple. It seems that OpenUDID is the most widely used
open source UDID alternative. OpenUDID is super simple to implement in
your project and is supported by a slew of advertising providers.

NSString *openUDID = [OpenUDID value];

OpenUDID uses a very clever way to persist the identifier across
applications. It uses specially named Pasteboards to store the
identifier. This way, other apps that also use OpenUDID know where to
go look and can grab the already generated identifier instead of
generating a new one.