# Hex bytes slice

`hex-bytes-slice` · version 1.0.0 · Encoding & checksums · free, no key needed

Slice a lowercase hex byte string by explicit byte-index bounds, half-open like Array.slice.

**Use when you need to: hex bytes slice · slice hex byte string · byte-range slice of hex.**

## Supported

- hex bytes slice
- slice hex byte string
- byte-range slice of hex

## Not supported

- negative indexes
- python wrap-around slicing
- uppercase hex
- 0x prefix
- code-point or character slicing
- decode hex to text

## Behavior

- hex is a lowercase hex byte string: 0-9 and a-f only, two hex digits per byte, no 0x prefix, no separators, no whitespace, no uppercase.
- hex is bounded to 128000 bytes (256000 hex characters).
- start and end are JSON integers with Number.isInteger, each between 0 and the byte-count bound, counting whole bytes (not hex characters).
- The slice is the half-open byte interval [start, end): the byte at index end is not included.
- end must be greater than or equal to start; start and end must each be at most the byte length of hex. Negative indexes, wrap-around, and end < start are rejected rather than reinterpreted.
- A slice where start equals end is allowed at any valid position and returns an empty result.

## Input

- `hex` (string, required): max length 256000
- `start` (integer, required): min 0; max 128000
- `end` (integer, required): min 0; max 128000

## Output

- `hex` (string, required)

## Limits

- max input bytes: 128000
- max index: 128000

## Example

Request input:

```json
{
  "hex": "aabbccdd",
  "start": 1,
  "end": 3
}
```

Response:

```json
{
  "result": {
    "hex": "bbcc"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "hex-bytes-slice",
  "version": "1.0.0",
  "input": {
    "hex": "aabbccdd",
    "start": 1,
    "end": 3
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/hex-bytes-slice/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"hex":"aabbccdd","start":1,"end":3}'
```

The machine-readable contract is at [/v1/tools/hex-bytes-slice/versions/1.0.0](/v1/tools/hex-bytes-slice/versions/1.0.0).

### CLI

```sh
node cli.mjs run hex-bytes-slice 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Hex bytes xor](/tools/hex-bytes-xor): Byte-wise XOR of two equal-length lowercase hex byte strings. Transformation only; no cryptographic security claim.
- [Hex bytes concat](/tools/hex-bytes-concat): Concatenate a bounded ordered list of lowercase hex byte strings into one hex string.
- [UTF-8 hex](/tools/utf8-hex): Encode a Unicode string as lowercase hex of its UTF-8 bytes. Transformation only; no security claim.
- [Adler-32](/tools/adler32): Adler-32 of UTF-8 bytes (RFC 1950). Integrity check only; no security claim.
- [Base64 UTF-8](/tools/base64-utf8): Decode standard Base64 to UTF-8 text. Transformation only; no security claim.
- [CRC-32](/tools/crc32): CRC-32 of UTF-8 bytes (ISO 3309 / ZIP / PNG polynomial). Integrity check only; no security claim.
