# cj_md2 **Repository Path**: xffish/cj_md2 ## Basic Information - **Project Name**: cj_md2 - **Description**: 用仓颉语言实现的 md2 消息摘要算法 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-09-27 - **Last Updated**: 2025-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # md2-cj [![Crates.io](https://img.shields.io/badge/md2_cj-0.3.0-01917E)](https://gitcode.com/Cangjie-TPC/md2_cj) [![Crates.io](https://img.shields.io/badge/license-BSD%203-3DA638)](https://gitcode.com/Cangjie-TPC/md2_cj/blob/master/LICENSE) ![Crates.io](https://img.shields.io/badge/cjc-0.59.6-01917E) ![Crates.io](https://img.shields.io/badge/coverage-97.5%25-01917E) > 已支持 SDK 0.59.6 仓颉编程语言实现的 md2 算法,md2 是一种消息摘要算法,用于生成消息摘要。相关RFC文档参见: * https://www.rfc-editor.org/rfc/rfc1319.html * https://www.rfc-editor.org/errata/eid555 ## 特性 * 字符串和文件的 md2 值计算 * 内部是流的统一实现,为文件和网络流或其他任意流的支持做好了准备 * 测试覆盖率 97.5% * 拉取代码后执行 `cjpm test --coverage` * 再执行 `cjcov --root=./ --html-details -o html_output` * 打开 html_output/index.html 即可查看覆盖率报告 ## 如何使用 1. 在你的项目的 cjpm.toml 里添加 ```toml [dependencies] md2_cj = { git = "https://gitcode.com/Cangjie-TPC/md2_cj.git", tag = "0.3.0" } ``` 2. 在项目根目录执行 `cjpm update` 以更新依赖 3. 在代码中使用,以下是一个示例 ```cangjie import std.fs.Path import md2_cj.md2 main() { println(md2("hello world")) let filePath = Path("./cjpm.toml") println(md2(filePath)) } ``` ## 文档 api > 目前就 2 个 > * md(String) 传入字符串,返回 md2 值 > * md(Path) 传入文件路径,返回 Some(md2值),如果不是有效文件返回 None 或者 拉下仓库代码后在根目录下执行 `cjpm doc` 生成文档,本项目已经写好了 Doxyfile 文件和样式美化。执行命令完毕后,会在根目录下生成 `html` 文件夹,打开 `html/index.html` 即可查看文档。 ## 消息摘要算法 MD2 介绍 详见 docs/md2_algorithm.md ## Minimum Supported Cangjie Version (cjnative) The current cjnative is 0.59.6 ## License See the [LICENSE](https://gitcode.com/Cangjie-TPC/cj_md2/blob/master/LICENSE) file at the root of the repository. ## Contributors - xffish: [@xffish](https://gitcode.com/xffish)