Skip to content

tiankonguse/cpp-md5-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP-MD5-LIB

一个c/c++版本的MD5程序库。

说明

我已经写好了 cmake 文件, 并写好了run.sh脚本自动执行cmake。

所以只需要把run.sh脚本复制到bulid目录,然后执行 ./run.sh 脚本。

就会在 lib 目录中生成对应的静态库。

关于cmake 的使用,可以参考我的一篇笔记:cmake 学习笔记

使用时只需要引入对应的头文件,然后就可以调用md5函数了。

例如

#include "md5.h"

md5(string)

测试

我还在 test 目录里简单的实现了一个测试程序。

执行 make 命令将会生成一个名字是 demo的可执行程序。

测试如下

echo -n "tiankonguse" | md5sum
77192a8e3dc5fb2b7428566f9741ebfc *-

./demo tiankonguse
md5 of 'tiankonguse': 77192a8e3dc5fb2b7428566f9741ebfc


echo -n "hello word" | md5sum
13574ef0d58b50fab38ec841efe39df4 *-

./demo "hello word"
md5 of 'hello word': 13574ef0d58b50fab38ec841efe39df4