调用地址
无需鉴权
支持 CORS
每 IP 每分钟 120 次
在线调试
请求会发送到本站接口当前请求:https://api.blueworkshop.top/api/v1/hash
请求参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
text必填 |
string | - | 要计算摘要的文本,最多 500 字符(GET 查询串长度有限)。 示例: hello |
algorithm |
枚举:sha256 / sha1 / sha512 / md5 | sha256 |
哈希算法。 示例: sha256 |
请求示例
cURL
curl "https://api.blueworkshop.top/api/v1/hash?text=hello&algorithm=sha256"
JavaScript
const res = await fetch("https://api.blueworkshop.top/api/v1/hash?text=hello&algorithm=sha256");
const data = await res.json();
console.log(data);响应示例
{
"ok": true,
"data": {
"algorithm": "sha256",
"inputLength": 5,
"digest": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
},
"meta": {
"endpoint": "hash",
"cached": false
}
}
成功时返回 JSON 信封:ok 表示是否成功,data 为数据,meta.cached 表示是否命中本站缓存。图片类接口直接返回二进制图片。
错误响应
| HTTP | 错误码 | 说明 |
|---|---|---|
| 400 | missing_param / invalid_param | 缺少参数或参数格式不正确,响应会带上出错参数名。 |
| 404 | not_found | 接口不存在,或上游没有找到对应资源。 |
| 405 | method_not_allowed | 请求方法与接口要求不一致。 |
| 429 | rate_limited | 请求过于频繁,响应头 Retry-After 给出建议等待秒数。 |
| 502 | upstream_error / upstream_rate_limited | 上游服务异常或触发限流。 |
| 504 | timeout | 上游请求超时。 |
接口说明
在服务端对传入文本计算哈希摘要,输入不落库、不写日志。支持 SHA-256、SHA-1、SHA-512 与 MD5。
MD5 与 SHA-1 仅适合校验或去重,不适合用于口令存储等安全场景;口令哈希请使用带盐的 scrypt、bcrypt 或 Argon2。