摘要计算
计算八种小写十六进制摘要
POST
/hash公开访问
访问类别:匿名 API,可携带 Token 使用独立额度
请求体
application/jsontext必填- string · 最长:8192 字符
响应
200 计算结果
application/json
{
"type": "object",
"properties": {
"md5": {
"type": "string",
"minLength": 32,
"maxLength": 32,
"pattern": "^[0-9a-f]+$",
"description": "32 位小写十六进制摘要"
},
"sha1": {
"type": "string",
"minLength": 40,
"maxLength": 40,
"pattern": "^[0-9a-f]+$",
"description": "40 位小写十六进制摘要"
},
"sha256": {
"type": "string",
"minLength": 64,
"maxLength": 64,
"pattern": "^[0-9a-f]+$",
"description": "64 位小写十六进制摘要"
},
"sha384": {
"type": "string",
"minLength": 96,
"maxLength": 96,
"pattern": "^[0-9a-f]+$",
"description": "96 位小写十六进制摘要"
},
"sha512": {
"type": "string",
"minLength": 128,
"maxLength": 128,
"pattern": "^[0-9a-f]+$",
"description": "128 位小写十六进制摘要"
},
"sha3_256": {
"type": "string",
"minLength": 64,
"maxLength": 64,
"pattern": "^[0-9a-f]+$",
"description": "64 位小写十六进制摘要"
},
"sha3_512": {
"type": "string",
"minLength": 128,
"maxLength": 128,
"pattern": "^[0-9a-f]+$",
"description": "128 位小写十六进制摘要"
},
"crc32": {
"type": "string",
"minLength": 8,
"maxLength": 8,
"pattern": "^[0-9a-f]+$",
"description": "8 位小写十六进制摘要"
}
},
"required": [
"md5",
"sha1",
"sha256",
"sha384",
"sha512",
"sha3_256",
"sha3_512",
"crc32"
]
}400 请求校验或执行失败
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}401 凭据无效、停用、过期或缺少所需 Token
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}403 需要管理员 Token
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}413 请求校验或执行失败
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}415 请求校验或执行失败
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}429 请求过于频繁,Retry-After 为建议等待秒数;匿名额度及认证保护在各 Cloudflare 地点近似计数,Token 业务额度使用 D1 原子计数
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}500 内部执行失败
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}响应示例
运行命令前,将环境变量 BASE_URL 设置为站点地址。
成功响应
printf '%s' '{"text":"你好 🌍"}' | curl --silent --show-error -X POST -H 'User-Agent: simpleWebUtils-example/1.1.0' -H 'Content-Type: application/json' -H 'Accept: application/json' "$BASE_URL"'/hash' --data-binary @-HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"md5": "5a47f421117a95e415bc7179ace595ea",
"sha1": "1baff48673ec8f3119e68a35d30f4615254bf920",
"sha256": "f08cb77716872850d2288160ef812e2681ccc1e5ed8854e5e634c21b9256e18c",
"sha384": "4ef227c6e3c9823d2d44737d5b11ce5898218672957776080447ade72687ab61af185ff75ee7260bbebee9838258ef64",
"sha512": "ddb82ff714fa781c4856675eecd5004709f5aae587915e5cf98474f1c69ae3d2de8b64c8342ff4ba5089eb58ec5e0d7ad88f1a9972047de11faf99987df78c2b",
"sha3_256": "77070e2e44c456b48682a832c2a549789340d3e6247f8887561b38d6fbd0b392",
"sha3_512": "7b734a5fb7cfc583d049ba44b515000cb63a3e1a87dd9784a0b788f641118cee5c9fa4552dd5bb49a385ade2cf5590dd9f094b275d904b0d7eae1c6776b7d03b",
"crc32": "aee7da7f"
}错误示例
printf '%s' '{}' | curl --silent --show-error -X POST -H 'User-Agent: simpleWebUtils-example/1.1.0' -H 'Content-Type: application/json' -H 'Accept: application/json' "$BASE_URL"'/hash' --data-binary @-HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"error": {
"code": "INVALID_INPUT",
"message": "参数无效",
"issues": [
{
"location": "body",
"field": "text",
"code": "invalid_type",
"message": "需要 字符串 类型"
}
]
}
}在线调试
调用示例
curl -X POST 'https://oit.sh/hash' \
-H 'Content-Type: application/json' \
--data-raw '{"text":"你好 🌍"}'响应
等待发送请求
配置上方请求参数后点击「发送请求」查看实时响应
快捷键:Ctrl / ⌘ + Enter