资源简介
从GMSSL整理出来的SM3哈希算法,文件只有sm3.c test.c两个,其它文件需要自行安装openssl,内有makefile,可直接编译,修改CROSS_COMPIER_PREFIX的值即可编译成不同的平台使用。
代码片段和文件信息
/* ====================================================================
* Copyright (c) 2014 - 2017 The GmSSL Project. 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. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* “This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)“
*
* 4. The name “GmSSL Project“ must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called “GmSSL“
* nor may “GmSSL“ appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* “This product includes software developed by the GmSSL Project
* (http://gmssl.org/)“
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ‘‘AS IS‘‘ AND ANY
* EXPRESSED 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 GmSSL PROJECT OR
* ITS 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.
* ====================================================================
*/
#include
#include
#include “internal/byteorder.h“
void sm3_init(sm3_ctx_t *ctx)
{
ctx->digest[0] = 0x7380166F;
ctx->digest[1] = 0x4914B2B9;
ctx->digest[2] = 0x172442D7;
ctx->digest[3] = 0xDA8A0600;
ctx->digest[4] = 0xA96F30BC;
ctx->digest[5] = 0x163138AA;
ctx->digest[6] = 0xE38DEE4D;
ctx->digest[7] = 0xB0FB0E4E;
ctx->nblocks = 0;
ctx->num = 0;
}
void sm3_update(sm3_ctx_t *ctx const unsigned char* data size_t data_len)
{
if (ctx->num) {
unsigned int left = SM3_BLOCK_SIZE - ctx->num;
if (data_len < left) {
memcpy(ctx->block + ctx->num data data_len);
ctx->num += data_len;
return;
} else {
mem
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1039 2018-12-12 17:54 SM3-me\sm3test.c
文件 1000 2018-12-11 17:54 SM3-me\Makefile
文件 6204 2018-12-12 13:35 SM3-me\sm3.c
目录 0 2018-12-12 17:55 SM3-me
----------- --------- ---------- ----- ----
8243 4
相关资源
- 几种经典的Hash算法的实现(源代码)
- sm3 c版本
- 快充国标报文解析
- sm2/sm3算法验证工具,预运算、大数计
- 《GB-T 8566-2007信息技术 软件生存周期
- 计算文件hash值的源代码,包含crcmd2
- MEMS AND SENSORS SOFTWARE
- SM3算法的FPGA设计与实现.pdf
- 国标EPG(电视节目单标准文档
- WPA无线密码破解强悍的字典 ZerOne_WP
- gmssl 2.0测试sm2加解密、签名 sm3摘要
- MD5Hash.rar
- Hash校验工具 MD5 SHA1 CRC32
- Nginx安装url_hash插件.doc
- IsoHash 各向同性哈希
- Isotropic Hashing
- iNEMO-V2LSM303DLHC(3轴加速度+3轴地磁)
- Detecting Near-Duplicates for Web Crawling
- 啊D注入工具 v2.32 无限制版带Hash验证
- openssl_sm2_sm3_c.zip
- FbHashCal.apk
- SW国标材质库
- ProE国标工程图格式模板
- wce 抓hash工具
- 最新版国标 固定资产分类与代码GB/
- Endnote 本科论文格式GB/T 7714-2005
- 机械制图 CAD 国标 标题栏
- sm2、sm3源代码,openssl可直接调用
- 中国姓名汉语拼音字典大全 + 所有生
- SM2 加密解密
评论
共有 条评论