uuid-le-0.2013.313.0: Codec for little-endian Universally Unique Identifiers

Portabilityportable
Stabilityexperimental
Maintainerrhymoid@gmail.com
Safe HaskellNone

Data.UUID.LittleEndian

Contents

Description

This library is an extension of the uuid library, allowing one to read and write 'little endian' encoded UUIDs. Some systems, for instance UEFI, chose to defy the simple format of RFC 4122 and use this format.

Synopsis

Modified functions

toByteString :: UUID -> ByteStringSource

Encode a UUID into a ByteString in little-endian-ish byte order.

fromByteString :: ByteString -> Maybe UUIDSource

Extract a UUID from a ByteString in little-endian-ish byte order. The argument must be 16 bytes long, otherwise Nothing is returned.

toWords :: UUID -> (Word32, Word32, Word32, Word32)Source

Covert a UUID into a sequence of Word32 values. When stored in network byte order, this tuple encodes the UUID in little-endian-ish byte order.

fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUIDSource

Create a UUID from a sequence of Word32 values. The opposite of toWords.

Endianity tools

swapTupleEndianity :: (Word32, Word32, Word32, Word32) -> (Word32, Word32, Word32, Word32)Source

Swaps the endianity of a UUID Word32 tuple.

swapListEndianity :: [Word8] -> [Word8]Source

Swaps the endianity of a UUID byte list, if the list is at least eight bytes long. Otherwise, it returns the original list.