1 Star 0 Fork 0

Fortran-stack / SM3-Fortran

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-2-Clause

SM3-Fortran 杂凑(哈希)

SM3 密码杂凑算法是一种类似 SHA-256 的哈希算法,属于中国国家标准,本库仅包含一个 GmSSL 的 Fortran 接口及使用示例

基于兴趣,我学习了杂凑算法,我做了一些尝试,但是 Fortran 缺乏无符号整形,不适合实现哈希算法,只能依靠 C Binding。 在开源代码中,GmSSL 以其完成度较高的代码质量,受到欢迎。完全使用 fpm 引入 GmSSL 代码将导致编译失败, 本库选择部分引入 GmSSL/SM3 算法代码,作为 SM3-Fortran 的依赖。Fortran 标准库已经有了 Hash 算法, 引入 SM3-Fortran 有以下意义:

  • SM3 是国家标准的杂凑算法,GmSSL 是国人主导的项目,有着国人情怀;
  • SM3 安全性与 SHA-256 相当;
  • SM3-Fortran 是一个轻量化接口包,Fortran-Stdlib/Hash 体量相对更大;
  • SM3-Fortran 仅引入 SM3 算法,为其他算法的 Fortran Binding 提供实践参考。

中文 | English

依赖

开始

下载或克隆仓库到本地后,可使用 fpm 编译代码:

cd SM3-Fortran
fpm run --example demo      # 运行示例代码
fpm build --profile release
fpm build --profile release --flag "-DSM3_SSE3"     # 启动 SSE3 优化

也可以将 SM3-Fortran 添加到自建 fpm 项目:

[dependencies]
SM3-Fortran = { git = "https://gitee.com/fortran-stack/SM3-Fortran" }

学习 SM3 算法参考国家标准SM3-Fortran 使用请参考示例

参考链接

Copyright (c) 2022, 左志华 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

SM3 密码杂凑算法是一种类似 SHA-256 的哈希算法,属于中国国家标准,本库仅包含一个 GmSSL 的 Fortran 接口及使用示例。 展开 收起
FORTRAN 等 2 种语言
BSD-2-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
FORTRAN
1
https://gitee.com/fortran-stack/SM3-Fortran.git
git@gitee.com:fortran-stack/SM3-Fortran.git
fortran-stack
SM3-Fortran
SM3-Fortran
main

搜索帮助