> ## 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.

# sha

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

## 函数原型

`func sha(v1 string/bytes, s1 string)string`

### 参数介绍

| 参数名称 | 参数介绍   |
| ---- | ------ |
| v1   | 待加密数据  |
| s1   | 控制加密类型 |

## 举例

| 待转换数据   | 加密方式     | 转换语句                     | 输出结果                                                                                               |
| ------- | -------- | ------------------------ | -------------------------------------------------------------------------------------------------- |
| `admin` | `sha1`   | `sha("admin","sha1")`    | `d033e22ae348aeb5660fc2140aec35850c4da997`                                                         |
| `admin` | `sha384` | `sha(b"admin","sha384")` | `9ca694a90285c034432c9550421b7b9dbd5c0f4b6673f05f6dbce58052ba20e4248041956ee8c9a2ec9f10290cdc0782` |

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