摩斯密码
加密/解密 摩斯密码
接口信息
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| type | string | 是 | 编码类型(decode/encode) | encode |
| text | string | 是 | 加解密文本 | 1 |
[
{
"name": "type",
"type": "string",
"required": true,
"description": "编码类型(decode/encode)",
"example": "encode"
},
{
"name": "text",
"type": "string",
"required": true,
"description": "加解密文本",
"example": "1"
}
]
{"openapi":"3.1.1","info":{"title":"摩斯密码","description":"加密/解密 摩斯密码","version":"1.0.0"},"paths":{"/api/MorseCodec":{"get":{"summary":"摩斯密码","description":"加密/解密 摩斯密码","parameters":[{"name":"type","in":"query","required":true,"schema":{"type":"string","example":"encode"},"description":"编码类型(decode/encode)"},{"name":"text","in":"query","required":true,"schema":{"type":"string","example":"1"},"description":"加解密文本"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"servers":[{"url":"https://mini10.top","description":"当前访问入口(https)"}]}
{
"ret": 200,
"type": "encode",
"result": "...-- .----"
}
接口反馈
摩斯密码
接口说明
用于摩斯密码的加密与解密:将普通文本转换为摩斯电码,或将摩斯电码还原为文本。适合需要快速完成电码转换的开发者与工具类场景,免费调用,无需密钥。
调用地址
https://mini10.top/api/MorseCodec
请求方式
GET
鉴权说明
无需密钥,可直接调用。
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | 处理类型,取值为 encode(加密)或 decode(解密)。 |
| text | string | 是 | 待处理文本:加密时传普通文本,解密时传摩斯电码。 |
参数取值说明:type 仅支持 encode 与 decode 两种取值,分别对应加密与解密;text 需与 type 匹配,加密时传入原始文本,解密时传入由点、划及分隔符组成的摩斯电码。
成功响应示例
{
"ret": 200,
"type": "encode",
"result": "...-- .----"
}
响应字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| ret | number | 请求状态标识,成功时为 200。 |
| type | string | 本次请求的处理类型,与请求参数 type 一致,取值为 encode 或 decode。 |
| result | string | 处理结果:加密时为摩斯电码字符串,解密时为还原后的文本。 |
错误响应示例
{
"code": 0,
"msg": "请求方式不允许",
"errcode": 11018
}
业务错误码说明
| errcode | 含义 |
|---|---|
| 11001 | 未提供调用密钥 |
| 11002 | 密钥错误 |
| 11003 | 密钥已禁用 |
| 11004 | 积分余额不足 |
| 11005 | 请求过于频繁(QPM 限制) |
| 11006 | 接口维护中 |
| 11007 | 接口已禁用 |
| 11008 | 接口不可用 |
| 11009 | 密钥校验暂不可用 |
| 11010 | 积分系统暂不可用 |
| 11011 | 收费接口须提供有效密钥 |
| 11012 | 鉴权方式错误 |
| 11013 | 接口不存在 |
| 11014 | ***地址无效 |
| 11015 | ***地址不允许 |
| 11016 | ***请求失败 |
| 11017 | 服务暂不可用 |
| 11018 | 请求方式不允许 |
| 11019 | 当前IP不在白名单内 |
| 11020 | 启用出口代理须提供有效密钥 |
| 11021 | 未配置可用出口代理 |
| 11022 | 出口代理不可用 |
| 11023 | 密钥已过期 |
| 11024 | 令牌分配积分不足 |
| 11025 | 该密钥无权调用此接口 |
调用示例
终端 curl(bash)
curl "https://mini10.top/api/MorseCodec?type=encode&text=1"
curl "https://mini10.top/api/MorseCodec?type=decode&text=...--%20.----"
PHP
// 加密:将文本转换为摩斯电码
$url = "https://mini10.top/api/MorseCodec?type=encode&text=" . urlencode("1");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
// 解密:将摩斯电码还原为文本
$url = "https://mini10.top/api/MorseCodec?type=decode&text=" . urlencode("...-- .----");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
注意事项
- 本接口无需密钥、免费调用,请求中不要附加密钥类参数。
type与text必须匹配:加密时text传普通文本,解密时text传摩斯电码;两者不一致会得到非预期结果。- 摩斯电码由点(
.)、划(-)与空格分隔符组成,作为查询参数时务必进行 URL 编码,否则空格等字符可能被截断或解析异常。 - 返回的
result为字符串,请勿按数值处理;解密时若电码书写不规范,可能无法完整还原原文。 - 请使用 HTTPS 访问调用地址,避免参数与结果在传输过程中被篡改。
- 接口存在频率限制(QPM),请勿高频轮询;批量转换建议在本地合并请求或加入间隔控制。
快速上手
curl -s "https://mini10.top/api/MorseCodec?type=encode&text=1"
# type 可选 encode 或 decode,text 为待处理文本
# 结果在返回 JSON 的 result 字段
在线测试
// 结果将在此处显示