My Opera is closing 1st of March

Linux夜航船

Everything should be easy.

封装一个C语言的MD5共享库

, , , ,

算法的源码用的还是国外前辈的,封装为一个共享库,便于在不同的程序中使用。
测试程序test.c的全部代码如下。
#include <stdio.h>
/*
* 编译方法
*
* gcc -o test test.c libleomd5.so
* 此方法需要将libleomd5.so复制到系统路径下,例如/usr/lib
*
* gcc -o test test.c ./libleomd5.so
* 此方法需要将libleomd5.so复制到test所在路径下
*
* bayern.leo@gmail.com
*/
int main(int argc,char* argv[]) {
int i;
for(i=1;i<argc;i++) {
if(i+1<argc) {
if (strcmp(argv,"-s")==0)
printf("For string %s: %s\n",argv[i+1],MD5(argv[i+1]));
else if (strcmp(argv,"-f")==0)
printf("For file %s: %s\n",argv[i+1],MDFile(argv[i+1]));
}
}

return 0;
}
(2007-4-28有更新)
MD5-SHA1.tar.bz2

被扭曲的命令行,被扭曲的linux封装SHA1库,顺便更新一下MD5库

Write a comment

New comments have been disabled for this post.

February 2014
S M T W T F S
January 2014March 2014
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28