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

# EMV

> EMV (Europay, Mastercard, Visa) TLV data handling.

`iso8583sim.core.emv`

This module provides functions for parsing and building EMV Tag-Length-Value
encoded data, commonly found in ISO 8583 Field 55.

## Functions

### `parse_emv_data()`

```python theme={null}
def parse_emv_data(data: str) -> dict[str, str]
```

Parse EMV TLV data into a dictionary of tags and values.

**Parameters**

<ResponseField name="data" type="str" required>
  Hex-encoded EMV TLV data
</ResponseField>

<ResponseField name="Returns" type="dict[str, str]">
  Dictionary mapping tag strings to value strings (hex-encoded)
</ResponseField>

**Raises**

* `ValueError`: If data is malformed

### `build_emv_data()`

```python theme={null}
def build_emv_data(tags: dict[str, str]) -> str
```

Build EMV TLV data from a dictionary of tags and values.

**Parameters**

<ResponseField name="tags" type="dict[str, str]" required>
  Dictionary mapping tag strings to value strings (hex-encoded)
</ResponseField>

<ResponseField name="Returns" type="str">
  Hex-encoded EMV TLV data string
</ResponseField>

### `get_tag_name()`

```python theme={null}
def get_tag_name(tag: str) -> str
```

Get the description of an EMV tag.

**Parameters**

<ResponseField name="tag" type="str" required>
  Tag identifier (hex string)
</ResponseField>

<ResponseField name="Returns" type="str">
  Description of the tag, or "Unknown" if not found
</ResponseField>

### `explain_tvr()`

```python theme={null}
def explain_tvr(tvr_hex: str) -> list[str]
```

Explain Terminal Verification Results.

**Parameters**

<ResponseField name="tvr_hex" type="str" required>
  5-byte TVR as hex string (10 characters)
</ResponseField>

<ResponseField name="Returns" type="list[str]">
  List of issues/flags that are set
</ResponseField>

### `explain_cid()`

```python theme={null}
def explain_cid(cid_hex: str) -> str
```

Explain Cryptogram Information Data.

**Parameters**

<ResponseField name="cid_hex" type="str" required>
  CID byte as hex string
</ResponseField>

<ResponseField name="Returns" type="str">
  Description of the cryptogram type
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.