diff --git a/book.xml b/book.xml index 4d1fd1c..2e7c1b6 100644 --- a/book.xml +++ b/book.xml @@ -8,6 +8,7 @@ + @@ -21,4 +22,7 @@ + + + diff --git a/command/encrypt-example.md b/command/encrypt-example.md new file mode 100644 index 0000000..5700959 --- /dev/null +++ b/command/encrypt-example.md @@ -0,0 +1,8 @@ +# command/encrypt-example.png + +![an example shows how to encrypt a text message](./encrypt-exapmle.png) +an example shows how to encrypt a text message + +```base64 +YmFzZTY0LCBiNjQKYmFzZTY0dXJsLCBiYXNlNjR1LCBiNjR1CmJhc2U2NGRlY29kZSwgYmFzZTY0ZCwgYjY0ZApiYXNlNjR1cmwtZGVjb2RlLCBiYXNlNjR1ZCwgYjY0dWQKc2hhMQpzaGEyNTYKc2hhNTEyCm1kNQotLS0KdXBwZXJjYXNlLCB1cHBlciwgdSAoc2hhMS9zaGEyNTYvc2hhNTEyL21kNSBvbmx5KQ== +``` diff --git a/command/encrypt-exapmle.png b/command/encrypt-exapmle.png new file mode 100644 index 0000000..9ce4e11 Binary files /dev/null and b/command/encrypt-exapmle.png differ diff --git a/command/encrypt-file-out.png b/command/encrypt-file-out.png new file mode 100644 index 0000000..9100301 Binary files /dev/null and b/command/encrypt-file-out.png differ diff --git a/command/encrypt.md b/command/encrypt.md new file mode 100644 index 0000000..b8251f3 --- /dev/null +++ b/command/encrypt.md @@ -0,0 +1,79 @@ +# /encrypt + +> > ` [(uppercase)]` reply_to(text) | `[l]` +> +> 通过指定算法加密回复的内容 (目前只支持文本) + +通过此命令,Morny 可以返回一个信息的加密(或解密)后数据。 + +## usage - 用法 + +通过使用 `/encrypt ` 回复一条消息,Morny 即会返回这条消息通过这个算法处理后的结果。 + +![an example shows how to encrypt a text message](./encrypt-exapmle.png) +一个使用 base64 加密处理一段文字的例子 +你可以从[这里](./encrypt-example)找到例子中返回的 base64 文本,来自己尝试解密 + + +如果是文本消息,则 Morny 会对其中的文本进行处理,然后同样的以文本消息的方式返回通过指定算法加密后的字符串消息。注意**文本消息中的格式会被忽略**! + +如果是图片或是文件等消息,Morny 将会**处理这个消息中的第一个图片/文件**并返回它作为二进制文件通过指定算法后加密的消息字符串。要注意的是,Telegram 的一个消息内可能包含多个图片或文件,但 Morny 只能处理第一个!同时,图片或文件消息所附带的文字也会被忽略。 + +处理文件有两种返回方式:如果是杂凑算法,则会和文本消息一样返回一个文本消息;如果是普通的加密算法,则会返回一个包含加密后信息的文件。 + +![the /encrypt output the text while using md5, but output a file while using b64](./encrypt-file-out.png) + +### algorithms - 支持的算法 + + + +Morny 目前支持以下算法: + +> 每行中的加重显示的名称是算法的全名,其余是这个算法的别称 +> 以猩红色标识开头的算法是支持使用 [`uppercase`](#uppercase) 参数的杂凑算法 + +- `base64`{.m}, `b64` +- `base64url`{.m}, `base64u`, `b64u` +- `base64decode`{.m}, `base64d`, `b64d` +- `base64url-decode`{.m}, `base64ud`, `b64ud` +- {.a}`sha1`{.m} +- {.a}`sha256`{.m} +- {.a}`sha512`{.m} +- {.a}`md5`{.m} + +你也可以通过对 Morny 使用 `/encrypt l`或者简单是 `/encrypt`来得到这个列表。 + +### 加密参数 + +`/encrypt` 命令可以通过加密参数控制如何进行加密过程或是输出加密信息。加密参数应以空格分隔,附加在算法参数的后面,像是 `/encrypt [param1] [param2]...`。 + +目前仅只持了 [`uppercase`](#uppercase) 加密参数。 + +#### `uppercase` + +> also known as `upper` +> also known as `u` + +这个参数使得 Morny 在返回杂凑值的时候使用大写字母书写十六进制数字。 + +只能用于杂凑算法。 + +--- + +## known issue + +这个版本虽然在简介里说了 *「目前只支持文本」*,然而它确实的支持了对文件和图片进行处理。 + +最开始的初版确实是不支持的,不过后来加上了简单的支持后忘记把这句话移掉了。尽管这么说,对于文件的处理(由于 API 复杂性)确实并不能让人满意或是放心。所以如果你遇到了什么问题,还是来积极报告一下以让这个功能更加稳定好用。 diff --git a/command/overview.md b/command/overview.md index 68ae58a..ad0120a 100644 --- a/command/overview.md +++ b/command/overview.md @@ -64,7 +64,7 @@ -/encrypt +/encrypt [algorithm] [(uppercase)] with reply_to(text) | [(l)] 通过指定算法加密回复的内容 (目前只支持文本) diff --git a/note-todo.md b/note-todo.md index 6b70317..604b9b3 100644 --- a/note-todo.md +++ b/note-todo.md @@ -10,7 +10,7 @@
-🟪🟪🟪⬜🟪🟪⬜⬜⬜⬜ ⬜⬜ ⬜⬜ +🟪🟪🟪⬜🟪🟪🟪⬜⬜⬜ ⬜⬜ ⬜⬜ ⬜⬜🟩🟩 🟧⬜⬜🟧🟧⬜⬜⬜ 🟦⬜⬜ @@ -27,7 +27,7 @@ - [ ] `/event_hack` - [x] ~~`/nbnhhsh`~~ - [x] ~~`/ip` `/whois`~~ - - [ ] `/encrypt` + - [x] ~~`/encrypt`~~ - [ ] `/info` /version /runtime - [ ] `/jrrp` - [ ] `/install`