# Keys

> USearch for C

A `usearch_key_t` is sixteen opaque bytes, enough for a UUID, a content hash, or a 64-bit integer with room to spare, and spelled canonically as a lowercase dashed UUID.
Integer identities sit big-endian in the last bytes with the rest zeroed, which is how the other bindings convert integers:

```c
usearch_key_t key_of(uint64_t value) {
    usearch_key_t key = {{0}};
    for (unsigned byte = 0; byte != 8; ++byte) key.bytes[15 - byte] = (uint8_t)(value >> (byte * 8));
    return key;
}
```

Keys need not be unique: an index admits up to its `values_per_key` entries under one key, unbounded by default, and the count verbs report how many a key holds.
A batch passes its keys as a `usearch_keys_view_t`, a pointer and a byte stride, where a zero stride repeats the first key for every row.

`#include <usearch/types.h>`

## usearch_key_t

User-facing 128-bit key identifying one entry of any index - sixteen opaque bytes, rendered canonically as a lowercase dashed UUID, matching SafeGraphs' `uuid` key column.

```c
struct usearch_key_t
```

Keys need not be unique: several entries may share one, and count-like functions report how many. Integer identities sit in the low bytes with the rest zeroed.

- `bytes` `usearch_byte_t`

## usearch_keys_view_t

A strided run of keys - how a batch names the identities it carries, one per row of the call's `count`, or one per entry a cursor pull wrote into its arena.

```c
struct usearch_keys_view_t
```

A zero `stride` repeats the first key for every row, which is how a batch of rows is written under one key without a caller materializing the copies. An output's keys are packed, so the call writes one key's size as `stride`.

- `data` `usearch_key_t const *`: First key of the run.
- `stride` `size_t`: Bytes between consecutive keys; zero repeats the first.

## usearch_keys_tape_view_t

A ragged run of keys a call wrote into its arena, for verbs whose entries name as many keys as each one links to: keys end to end, and one more offset than entries.

```c
struct usearch_keys_tape_view_t
```

Entry `i` spans `offsets`[i] up to `offsets`[i+1], so the last offset is the total.

- `keys` `usearch_key_t const *`: Every entry's keys, end to end.
- `offsets` `size_t const *`: The call's `written` + 1 non-decreasing offsets into `keys`.

