cURL
curl "https://api.ruseo.cn/api/sha?text=Hello+World&algo=sha256&output=hex&upper=false&hmac=demo"
SHA系列哈希加密,支持SHA-1/SHA-224/SHA-256/SHA-384/SHA-512/SHA3系列,可选HMAC模式,一次返回全部算法结果对比
https://api.ruseo.cn/api/sha
接口调用前需要确认的核心配置。
/api/shasha必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
text |
是 | string | 要加密的文本 | Hello World |
algo |
否 | string | 算法默认sha256,可选sha1/sha224/sha256/sha384/sha512/sha3-224/sha3-256/sha3-384/sha3-512 | sha256 |
output |
否 | string | 输出格式hex或base64默认hex | hex |
upper |
否 | string | 是否大写默认false | false |
hmac |
否 | string | HMAC密钥提供则使用HMAC模式 | |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/sha?text=Hello+World&algo=sha256&output=hex&upper=false&hmac=demo
curl "https://api.ruseo.cn/api/sha?text=Hello+World&algo=sha256&output=hex&upper=false&hmac=demo"
$url = 'https://api.ruseo.cn/api/sha?text=Hello+World&algo=sha256&output=hex&upper=false&hmac=demo';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/sha?text=Hello+World&algo=sha256&output=hex&upper=false&hmac=demo')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "sha",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
success |
boolean | 是否成功 | true |
algo |
string | 使用的算法 | sha256 |
bits |
number | 算法位数 | 256 |
output |
string | 加密结果 | |
hmac |
boolean | 是否HMAC模式 | false |
all |
object | 所有SHA算法结果对比 | |
点击左侧“发送请求”查看结果...