软件英才网软件行业驰名招聘网站有需要请联系我们搜索引擎的那些事(32位MD5算法)对于学过密码学的同学来说,md5算法肯定不会很陌生。但是,对于我来说,md5是一个新的命题。那什么是md5呢?md5就是对已有的数据进行加密处理。当然,它还有别的用处,什么呢?比如说,可以验证下载的软件是否完整,可以验证保存的字符串是否发生重名等等。我在这里提到这个算法,主要是为了后面一个目的,防止url重名使用的。整个算法的内容其实比较复杂的,我们自己只要学会使用就可以了。这里使用的就两个文件,,,头文件内容如下所示,[cpp]viewplaincopy?/*.*/??#ifndefMD5_H?#defineMD5_H??/*Unlikepreviousversionsofthiscode,uint32neednotbeexactly?32bits,?bitsinsteadof64isnotimportant;speedisconsiderablymore?"unsignedlong"willbebigenough,??andalwaysusingitseemstohavefewdisadvantages.*/??typedefunsignedlonguint32;????structMD5Context{??uint32buf[4];??uint32bits[2];??unsignedcharin[64];??};????voidMD5Init(structMD5Context*context);??voidMD5Update(structMD5Context*context,unsignedcharconst*buf,unsignedlen);??voidMD5Final(unsignedchardigest[16],structMD5Context*context);??voidMD5Transform(uint32buf[4],constunsignedcharin[64]);????/*??*ThisisneededtomakeRSAREFhappyonsomeMS-pilers.??*/??typedefstructMD5ContextMD5_CTX;????#endif/*!MD5_H*/源文件内容如下所示,软件英才网软件行业驰名招聘网站有需要请联系我们[cpp]viewplaincopy??/*??*ThiscodeimplementstheMD5message-digestalgorithm.??*??*writtenbyColinPlumbin1993,nocopyrightisclaimed.??*Thiscodeisinthepublicdomain;dowithitwhatyouwish.??*??*EquivalentcodeisavailablefromRSADataSecurity,Inc.
搜索引擎的那些事(32位MD5算法) 来自淘豆网m.daumloan.com转载请标明出处.