Page 1 of 1

### Unique Serial Number

Posted: Tue Jul 26, 2016 1:48 pm
Hi,

I just wanted to know if each raspberry pi has their own unique serial number. For instance will a Pi 3 and Pi 2 (or any other version of Pi) have the same serial number?

Thanks in advance for any help.

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 1:50 pm
Yes,

viewtopic.php?f=66&t=59864

(Google would have found this more quickly)

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 1:57 pm
Are you answering the main question if they are unique or the example?

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 2:05 pm
Dawkins12 wrote:Are you answering the main question if they are unique or the example?
Unique over the entire range of RPF product. They have to be otherwise the codecs keys would work on more than one device, since they are slaved to the serial number.

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 2:11 pm
thank you

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 6:49 pm
Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)

That does not affect the security of codec licensing, however. The overwhelming majority of serials will be unique, and there is no practical method to locate two matching ones.

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 7:39 pm
jojopi,
Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)
Interesting. The serial number is 16 hex digits or 64 bits. That means there are 2 to the power 64 possible serial numbers. Or 18446744073709552000 or about 1e20.

There have been about 10 million Pi sold. Or 1e7

So, if serial numbers were selected at random the chance of a collision, two Pi with the same serial number, is about 1e20/1e7 = 1e13 or one in 10,000,000,000,000.

So I would turn it around and say it is practically impossible that there are duplicates in the wild.

Now, who knows how the serial numbers are generated?

If every Pi was numbered, starting from 0, 1, 2, 3 etc then the serial number could just be a hash of that counter and it would appear to be random even if it is not. Or perhaps the serial number is a hash of the location and time of manufacture. These would of course be unique.

### Re: Unique Serial Number

Posted: Tue Jul 26, 2016 7:42 pm
jojopi wrote:Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)
So people in the know who say they are unique are lying?

The serial appears to be a 32 bit value (the top 32 bits of the value displayed are all 0). That gives a possibility of 4,294,967,295 values. Now, assuming there is some CRC error checking on there and not all values are used, (assume an 8 bit checksum), that still leaves 268,435,455 possible values. I think there is a good chance that they are really unique.

### Re: Unique Serial Number

Posted: Wed Jul 27, 2016 10:42 am
Uh Oh.

Turns out I was wrong in what I said above(*)

They are in fact random (generated using the HW RNG on the Pi itself during production testing), but as Heater states above, the chances of collision are vanishingly small, so there are no issues with COdec licensing etc.

Apologies for the misinformation.

* It had to happen sooner or later.

### Re: Unique Serial Number

Posted: Wed Jul 27, 2016 11:15 am
I guess the foundation could of used unique sequential serial numbers and worry about duplicates once the 18446744073709552001st pi was produced
Texy

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 8:33 am
... wouldn't using unique sequential serial numbers incur a logistical problem, given more than one manufacturer? (this occured to me right at the beginning, so it's been festering in my brain for four years or so!)
Ok, so RS could have used even numbers and E14 odd ones, but if at some stage a third company joined in, then a fourth, I can imagine the board-level discussions.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 8:57 am
... wouldn't using unique sequential serial numbers incur a logistical problem, given more than one manufacturer? (this occured to me right at the beginning, so it's been festering in my brain for four years or so!)
Ok, so RS could have used even numbers and E14 odd ones, but if at some stage a third company joined in, then a fourth, I can imagine the board-level discussions.
Probably why they are now random.

Usually, serial serial numbers would be assigned in batches to allow multiple manufacturing sites.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 9:38 am
Two thoughts:
1) If it's random, it's not a "serial" number. UID, maybe. Actually, since it's not guaranteed unique, UID ain't right. RID?
2) As jojopi says, the birthday paradox comes into play. If there are 2^32 possible RIDs, then a duplicate becomes statistically likely in a randomly selected group of more than 2^16 Pis. That is much less than the number of Pis produced, but much greater than the number likely to be in a potentially conflicting group. (Mathematicians please correct if I'm wrong.)

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 9:58 am
The serial number forms part of the MAC address, so I hope they are unique.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 10:46 am
Serial numbers are indeed generated from the internal HWRNG, programmed during factory test.

The serial number is 32bit, which as previous posters have pointed out means that it does suffer from the birthday problem. However you need to have a set of over 9000 Pis to have a 1% chance of serial number collision. Thus MAC collision is extremely unlikely and it's near-impossible to have a chance of circumventing the licence key requirement.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 12:39 pm
jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
That's only going to be a problem if you have 16 million on the same /8 subnet (and you'll run out of NAT port numbers with less than 64K stations). With NAT'd networks your only need to worry about your NAT router having a unique MAC for the upstream network.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 6:47 pm
DougieLawson wrote:
jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
That's only going to be a problem if you have 16 million on the same /8 subnet (and you'll run out of NAT port numbers with less than 64K stations). With NAT'd networks your only need to worry about your NAT router having a unique MAC for the upstream network.
I'm not sure that's accurate. You can't have the same MAC on the same LAN, so it only needs to match any machine in the same LAN to cause you an issue. The NAT you mention is an issue for your internet connection, it doesn't hide / mask anything behind that / on the LAN. And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
Now the chances of that conflict is a different story, that's probably close to zero, plus you can usually manually change the MAC on most machines these days anyway.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 6:56 pm
jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
A manufacturer can't (well they shouldn't) just arbitrarily make up MAC address. MAC Address are assigned in blocks to manufactures by IEEE. It's very common for manufactures to use the same MAC on multiple devices/machines, so a MAC address is not unique world wide, it only needs to be unique within a local subnet segment as to not cause the switch packed routing issues.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 7:27 pm
The RPF has an OUI assigned to them, it's the other half of the MAC that is tied to the serial number.

### Re: Unique Serial Number

Posted: Thu Jul 28, 2016 9:47 pm
mutley wrote: And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
You have more chance of winning a 6 from 49 lottery.

### Re: Unique Serial Number

Posted: Fri Jul 29, 2016 9:05 am
DougieLawson wrote:
mutley wrote: And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
You have more chance of winning a 6 from 49 lottery.
I should hope there is a greater chance than 1 in 49 of duplication !!

### Re: Unique Serial Number

Posted: Fri Jul 29, 2016 9:35 am
DougieLawson wrote:You have more chance of winning a 6 from 49 lottery.
The analogy is whether any two players in a group will pick the same numbers, not whether they will pick the winning numbers. The MAC uses just 24 bits of the serial number, so you "only" need to buy 4823 Pi for it to be more likely than not that you will have a MAC collision. It is still not a problem, but for completely different reasons than you gave. There are limits to the number of hosts you should cluster using layer 2 switches alone.

Going back to the original topic: truly random allocation is great because, even when it does produce collisions, you can be confident that they are rare and isolated and distributed among the entire population; impractical to find. By contrast, any kind of systematic allocation requires impeccable record keeping. The likely consequence of a mistake is that you release a full batch that duplicates some previous batchâ€”a much more serious problem.