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

# hmacSha

> `hmacSha`函数主要是用来将指定字符串或 bytes 进行 hmac_sha 系列计算

## 函数原型

`func hmacSha(v1 string/bytes, s1 string, s2 string)string`

### 参数介绍

| 参数名称 | 参数介绍  |
| ---- | ----- |
| v1   | 待加密数据 |
| s1   | 密码    |
| s2   | 加密方式  |

## 举例

| 待转换数据   | 密码    | 加密方式     | 转换语句                               | 输出结果                                                       |
| ------- | ----- | -------- | ---------------------------------- | ---------------------------------------------------------- |
| `admin` | `123` | `sha1`   | `hmacSha("admin","123","sha1")`    | `626db268028b3256e6fbcc90ea6214f2435f7d5d`                 |
| `admin` | `123` | `sha224` | `hmacSha(b"admin","123","sha224")` | `e5766f1372cc989ee270f7bc04a6f8366360f9a7d0b74b899d396d1e` |

支持的加密方式：`sha1`、`sha224`、`sha256`、`sha384`、`sha512`
