Proto3 Storing UUID

Skip to first unread message

Osman Ali

May 2, 2016, 1:27:30 PM5/2/16
to Protocol Buffers
Looking use a 128 bit uuid according to rfc4122. For Proto3 should use bytes type?


message SendIdentifier {
 bytes user_uuid = 1;

Adam Cozzette

May 6, 2016, 8:00:02 PM5/6/16
to Osman Ali, Protocol Buffers
The bytes type sounds like a good choice to me. I could also imagine using a pair of fixed64 fields if you want to avoid having to validate the length of the byte string.

You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Walter Schulze

May 7, 2016, 8:50:00 AM5/7/16
to Protocol Buffers,
I wish there was just a 128 bit type, that could be used for uuid and ipv6, but for now we are stuck with the choice between bytes and two fixed64s, and the two groups of people that disagree about which is better.

Jan 11, 2017, 5:35:00 PM1/11/17
to Protocol Buffers
Late answer, but I would have recommended string. Keeps it human readable and also, I suppose, not have to be concerned with endian order.

Bo Yang

Jan 11, 2017, 6:06:53 PM1/11/17
to, Protocol Buffers
I recommend bytes field. If you use string, it won't accept non-utf8 character.


Jan 11, 2021, 7:44:14 AMJan 11
to Protocol Buffers

I saw a pretty good suggestion in this issue thread: Provide support for UUID type (a.k.a. GUID) #2224 @gmabey suggested to make use of the layout presented in RFC4122 section 4.1.2,  @billpoole-mi then further expanded upon that idea by providing a possible implementation for that approach. 

Tom Hintz

Jan 12, 2021, 5:01:18 PMJan 12
to Protocol Buffers
Neither string or byte array are good solutions from a security perspective because they can be abused in certain kinds of DOS or fuzzing attacks.  I like the idea of a specific implementation.

Gargi Gupta

Aug 16, 2021, 4:03:37 PMAug 16
to Protocol Buffers
Can you elaborate on the kinds of DOS or fuzzing attacks?

Reply all
Reply to author
0 new messages