[Cryptography·Miracl Function Library Application] Introduction to Miracl Function Library

This tutorial is constantly being updated, so stay tuned.

Generate static resource library miracl.lib

Download the source code on github
https://github.com/miracl/MIRACL
and then follow the tutorial step by step. The compilation environment is the VS2017
tutorial link : https://www.bilibili.com/read/cv7663799
this tutorial There is also the corresponding test code

extern "C"
{
    
    
	#include "miracl.h"
	#include "mirdef.h"
}
#pragma comment(lib,"miracl.lib")
int main()
{
    
    
	miracl *mip = mirsys(500, 16); //初始化miracl系统
	big n = mirvar(8); //初始化n,必须有
	cotnum(n, stdout); //打印n
	cinnum(n, stdin); //输入n
	cotnum(n, stdout); //再次打印n
	return 0;
}

Start the first program

The success of the previous test program means that our static resource library has been compiled and can be used directly in the program. The corresponding functions and related usage methods are introduced below. How to use it has been described
in the previous blog , so I won’t repeat it here. , The rendering of the program running is given in this link , you can also refer to

Time difference processing

One purpose of calling this function library is to know the time efficiency of each function running and processing. This efficiency is our judgment of encryption and decryption or the evaluation of the efficiency of related operations. How to compare the efficiency, an important parameter is time, execution Average time
There is an important function to find the time difference in C language, which is the clock function. The following is the important program idea to call

start = clock();//开始时间

//功能代码

finish = clock();//结束时间
duration = (double)(finish - start) / CLOCKS_PER_SEC;//运行的总时间
printf("the duration is %lf \n", duration);

Please see this tutorial for the complete program code

Written at the end, our tutorial is written in two different places mainly because it is not convenient to take screenshots on the scdn, but it is not convenient to insert code on the B station, so please forgive the reader for the need to jump to the page. In addition, our tutorial will be constantly updated, so stay tuned.

Guess you like

Origin blog.csdn.net/m0_50984266/article/details/108756069