# Packing a UUID

**URL:** <https://www.ruby-forum.com/t/packing-a-uuid/167530>\
**Category:** Ruby\
**Created:** [May 9, 2009, 1:08am UTC](https://www.ruby-forum.com/t/packing-a-uuid/167530 "2009-05-09T01:08:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/41988e/32.png) [@ibw](https://www.ruby-forum.com/u/ibw)\
**Post date:** [May 9, 2009, 1:08am UTC](https://www.ruby-forum.com/t/packing-a-uuid/167530/1 "2009-05-09T01:08:35Z")

</div>

How can I pack a UUID using the array.pack method? I need to send a UUID  
through a UDP packet, and I can’t figure out how to do this, or  
specifically, which directive to use. I tried H and h, but neither  
really seemed to work.

---

<div class="post-metadata">

**Author:** ![ibw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/41988e/32.png) [@ibw](https://www.ruby-forum.com/u/ibw)\
**Post date:** [May 9, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/packing-a-uuid/167530/2 "2009-05-09T18:28:27Z")

</div>

Quoting Isaac W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> How can I pack a UUID using the array.pack method? I need to send a UUID  
> through a UDP packet, and I can’t figure out how to do this, or  
> specifically, which directive to use. I tried H and h, but neither  
> really seemed to work.

Take a look how it’s done here: [GitHub - spectra/ruby-uuid: Creates UUIDs version 1, 3, 4, and 5 in pure ruby.](http://github.com/spectra/ruby-uuid)
