> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Hex (Swift)

> Encode and decode hex strings

# Hex

Simple hex encoding/decoding utilities.

## Quick Start

```swift theme={null}
import Voltaire

let bytes: [UInt8] = [0xde, 0xad, 0xbe, 0xef]
let hex = Hex.encode(bytes) // "0xdeadbeef"
let roundtrip = try Hex.decode(hex)
XCTAssertEqual(roundtrip, bytes)

 // Foundation.Data support
 import Foundation
 let data = Data([0xca, 0xfe])
 XCTAssertEqual(Hex.encode(data), "0xcafe")
```
