• 大小: 1.55MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-02
  • 语言: C/C++
  • 标签: C语言  C++  SM2  

资源简介

国密算法SM2算法 C语言源码 签名验签 加解密, 密钥交换

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include “sm2.hpp“


#if 0
######################################
x86: CPU 2.8G
sm2_sign speed:147.058824/s
sm2_verify speed:116.414435/s
sm2_verify OK!===1
sm2_encrypt speed:74.404762/s
sm2_decrypt speed:150.602410/s
sm2_decrypt OK!

######################################

#endif


void my_ecc192_test()
{
int pv_len;
unsigned char pv[] = {0x000x000x000x000x000x000x000x000xF60x5A0x8E0xBA0xA70x8D0x490xFB
 0xAA0xB80x8C0xCC0x5D0xC40x070x680xB40x0F0x430x1C0xE10x3B0x2E0xB6};
int px_len;
unsigned char px[] = {0x000x000x000x000x000x000x000x000x460x3D0xED0x0D0xDA0x970xF10x00
 0x250x0C0x850xE50x380x8C0xAF0xFE0x9F0x5F0x740x730xD90x610x7F0x75};
int py_len;
unsigned char py[] = {0x000x000x000x000x000x000x000x000xC60x850x850x000xD20xD10x0D0xD8
 0x1D0x7E0xE30x600xDC0x470xD40x1D0x220x5E0x880x1D0x6A0x940x2D0x80};
int hash_len;
unsigned char hash[] = {0x490x8C0x740x880x3E0x910xAA0xEB0xA70x1D0x0D0xA10xCB0x6A0x630x630x600xD10x700x06};
int sign1_len;
unsigned char sign1[] = {0x000x000x000x000x000x000x000x000x1F0xBC0xDE0xB80x7F0x6D0x520x68
 0x560xBD0x500xA20xFC0x6F0x510x580xF10x120xD00x950x390x090xC90xFB};
int sign2_len;
unsigned char sign2[] ={0x000x000x000x000x000x000x000x000x030xEF0xD80x600xC00xF30x760x09
 0x350x630xC40xA10x680xF60x330xDC0xBB0x6D0x330x4B0x9F0xD00xFD0xD9};

int ij;

printf(“\n[my_ecc192_test_input]:“);
printf(“\npv = “);
for(i=0; i printf(“\npx = “);
for(i=0; i printf(“\npy = “);
for(i=0; i printf(“\nhash = “);
for(i=0; i printf(“\nsign1 = “);
for(i=0; i printf(“\nsign2 = “);
for(i=0; i
printf(“\n[priv_sign ]:“);
unsigned char cr[32]cs[32];
int cr_lencs_len;
sm2_sign(hashsizeof(hash)pvsizeof(pv)cr&cr_lencs&cs_len);
printf(“\ncr_len = %d cr = “cr_len);
for(i=0; i printf(“\ncs_len = %d cs = “cs_len);
for(i=0; i
printf(“\n[verify sign ]: “);
i = sm2_verify(hashsizeof(hash)sign1sizeof(sign1)sign2sizeof(sign2)pxsizeof(px)pysizeof(py));
printf(“%s\n“(i==0)?(“err“):(“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1039  2010-10-21 15:12  miracl\aesgcm.txt

     文件       3284  2009-03-19 12:52  miracl\ake.txt

     文件      11768  2010-11-26 10:50  miracl\ake12blsa.cpp

     文件       9822  2010-07-22 16:33  miracl\ake12bna.cpp

     文件      10170  2009-12-17 11:19  miracl\ake12bne.cpp

     文件      12945  2010-05-20 14:22  miracl\ake12bnr.cpp

     文件      14937  2010-11-22 14:45  miracl\ake12bnx.cpp

     文件      17353  2010-11-18 17:38  miracl\ake18kssx.cpp

     文件      11553  2010-03-09 15:57  miracl\ake1kmt.cpp

     文件      13650  2010-12-10 12:51  miracl\ake24blsa.cpp

     文件       9197  2010-06-16 09:11  miracl\ake2cpt.cpp

     文件       8824  2009-03-25 11:27  miracl\ake2cpt2.cpp

     文件       5880  2008-10-08 10:19  miracl\ake2cpw.cpp

     文件      10415  2009-03-25 11:27  miracl\ake2nsst.cpp

     文件       8598  2009-03-31 17:07  miracl\ake2sst.cpp

     文件       8015  2010-11-16 17:22  miracl\ake4cpt.cpp

     文件       8418  2009-12-07 11:50  miracl\ake4fsta.cpp

     文件      25151  2009-03-25 11:28  miracl\ake4mnta.c

     文件       8526  2009-12-17 11:25  miracl\ake4mnta.cpp

     文件      20028  2009-03-25 11:30  miracl\ake4mntt.c

     文件       9111  2010-11-16 15:17  miracl\ake4mntt.cpp

     文件       9497  2009-12-17 11:28  miracl\ake4sbt.cpp

     文件       8633  2009-12-07 11:08  miracl\ake6fsta.cpp

     文件      10764  2010-11-25 16:19  miracl\ake6mnta.cpp

     文件      20264  2009-12-03 13:03  miracl\ake6mntt.c

     文件      11231  2010-02-01 18:25  miracl\ake6mntt.cpp

     文件      10957  2009-12-17 11:25  miracl\ake6mntx.cpp

     文件      10326  2010-11-17 15:31  miracl\ake8bwt.cpp

     文件       9274  2010-11-17 15:30  miracl\ake8cpt.cpp

     文件      12260  2007-09-19 11:26  miracl\amd64.mcs

............此处省略515个文件信息

评论

共有 条评论