# e2e-protection
End-to-End **protection** library focused on **E2E usage** (not a CRC toolkit).
- Profiles:
- **P11** (CAN): `payload | data_id(2) | counter(1) | crc8(1)` – 8-byte frames
- **P22** (CAN FD): `payload | length(2) | data_id(2) | counter(1) | crc(N)` – up to 64B
- **Session API**: enforces counter policy (monotonic + rollover).
## Quick start
```rust
use e2e_protection::{E2eSession, CounterPolicy, E2eProfile};
use e2e_protection::p11::Profile11;
let mut tx = E2eSession::new(
Profile11::preset_sae_j1850(0x0042),
CounterPolicy::MonotonicRollover { bits: 8, step: 1 },
);
let frame = tx.wrap(&[0x12, 0x34, 0x56, 0x78])?;
let mut rx = E2eSession::new(
Profile11::preset_sae_j1850(0x0042),
CounterPolicy::MonotonicRollover { bits: 8, step: 1 },
);
let payload = rx.unwrap(&frame)?;
assert_eq!(payload, &[0x12, 0x34, 0x56, 0x78]);