> For the complete documentation index, see [llms.txt](https://coherence.3vidence.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coherence.3vidence.com/hmac.md).

# HMAC

## MAC

[HMAC video](https://www.youtube.com/watch?v=DiLPn_ldAAQ\&index=22\&list=PL6N5qY2nvvJE8X75VkXglSrVhLv1tVcfy)

In order to understand *hex* and *type* parameters read [Hash](https://github.com/liesware/coherence/wiki/Hash)

### HMAC

[spec](https://tools.ietf.org/html/rfc2104)

Description: Message authentication code based on hash.

Uses: General porpuse

## How to ???

```python
import requests
import json
import os,binascii

def sending(message):
    url = 'http://127.0.0.1:6613/'
    response = requests.post(url, data=message)
    print response.content
    return response.content

data_js='{"version":1,"algorithm":"HMAC","type":"string","plaintext":"Hello world!","hex":0,\
"key":"0123456789ABCDEF0123456789ABCDEF","family":"sha3_512"}'
sending(data_js)
```

Calculate HMAC-SHA3*512 to string* "Hello world!"\_ with the key given.

On *data\_js\["family"]* can be one of *{sha3\_512, sha3\_384, sha3\_256, sha3\_224, sha\_512, sha\_384, sha\_256, sha\_224, sha\_1 ,whirlpool}*

Json to HMAC string

```javascript
{"version":1,"algorithm":"HMAC","type":"string","plaintext":"your string","hex":BOOL,
"key":"hex string","family":"hash flavor"}
```

Json to HMAC file

```javascript
{"version":1,"algorithm":"HMAC","type":"file","file":"your file",
"key":"hex string","family":"hash flavor"}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coherence.3vidence.com/hmac.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
