# Data Utilities (`data`)
Utilities for numbers, dates, IDs, and cryptographic operations.
## Features
- **Numbers**: `format_number`, `format_currency`, `format_percentage`, `round`, `ceil`, `floor`, `clamp`, `lerp`
- **Dates**: `now`, `today`, `format_date`, `parse_date`, `add_days`, `diff_days` (feature: `dates`)
- **IDs**: `uuid_v4`, `uuid_v7`, `ulid`, `is_uuid`, `is_ulid` (feature: `ids`)
- **Hashing**: `hash_sha256`, `verify_sha256`, `generate_token`, `secure_compare` (feature: `crypto`)
## Quick Start
```rust
use rok_utils::data::numbers::{format_number, format_currency, round};
format_number(1234567.89, 2, ','); // "1,234,567.89"
format_currency(1234.50, "USD"); // "$1,234.50"
round(3.14159, 2); // 3.14
```
## Date Operations
```rust
use rok_utils::{now, today, format_date, add_days};
let today = today();
let tomorrow = add_days(&today, 1);
let now = now();
let formatted = format_date(&now, "%Y-%m-%d");
```
## UUID/ULID Generation
```rust
use rok_utils::{uuid_v4, uuid_v7, ulid, is_uuid};
let uuid = uuid_v4(); // "550e8400-e29b-41d4-a716-446655440000"
let uuid7 = uuid_v7(); // Time-ordered UUID
let id = ulid(); // "01ARZ3NDEKTSV4RRFFQ69G5FAV"
assert!(is_uuid(&uuid));
```
## Hashing
```rust
use rok_utils::{hash_sha256, verify_sha256, generate_token};
let hash = hash_sha256("password");
assert!(verify_sha256("password", &hash));
let token = generate_token(32); // 32 bytes as hex string
```
## Secure Comparison
```rust
use rok_utils::secure_compare;
assert!(secure_compare("secret", "secret"));
assert!(!secure_compare("secret", "Secret")); // Constant-time comparison
```
## Feature Flags
| `full` | Enable all features |
| `dates` | Enable date/time utilities |
| `ids` | Enable UUID/ULID generation |
| `crypto` | Enable hashing and token generation |
## See Also
- [Main examples](../docs/examples.md)