Proto3 Storing UUID

6,948 views
Skip to first unread message

Osman Ali

unread,
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?

So:

message SendIdentifier {
 bytes user_uuid = 1;
}


Adam Cozzette

unread,
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 protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Walter Schulze

unread,
May 7, 2016, 8:50:00 AM5/7/16
to Protocol Buffers, osman...@gmail.com
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.

to...@appcelerator.io

unread,
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

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

Pheubel

unread,
Jan 11, 2021, 7:44:14 AM1/11/21
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

unread,
Jan 12, 2021, 5:01:18 PM1/12/21
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

unread,
Aug 16, 2021, 4:03:37 PM8/16/21
to Protocol Buffers
Can you elaborate on the kinds of DOS or fuzzing attacks?
Thanks

Reply all
Reply to author
Forward
0 new messages