{具体使用方法如下,另外还附有源代码: 加密字符串aaa MD5String('aaa') MD5加密算法(DELPHI)} unit md5;
uses type procedure MD5Init(var Context: MD5Context); function MD5String(M: string): MD5Digest; function MD5Match(D1, D2: MD5Digest): boolean; // ----------------------------------------------------------------------------------------------- var function F(x, y, z: DWORD): DWORD; function G(x, y, z: DWORD): DWORD; function H(x, y, z: DWORD): DWORD; function I(x, y, z: DWORD): DWORD; procedure rot(var x: DWORD; n: BYTE); procedure FF(var a: DWORD; b, c, d, x: DWORD; s: BYTE; ac: DWORD); procedure GG(var a: DWORD; b, c, d, x: DWORD; s: BYTE; ac: DWORD); procedure HH(var a: DWORD; b, c, d, x: DWORD; s: BYTE; ac: DWORD); procedure II(var a: DWORD; b, c, d, x: DWORD; s: BYTE; ac: DWORD); // ----------------------------------------------------------------------------------------------- // Encode Count bytes at Source into (Count / 4) DWORDs at Target // Decode Count DWORDs at Source into (Count * 4) Bytes at Target // Transform State according to first 64 bytes at Buffer // ----------------------------------------------------------------------------------------------- // Initialize given Context // Update given Context to include Length bytes of Input // Finalize given Context, create Digest and zeroize Context // ----------------------------------------------------------------------------------------------- // Create digest of given Message // Create digest of file with given Name // Create hex representation of given Digest // ----------------------------------------------------------------------------------------------- // Compare two Digests end. |
|
来自: changkongzhi > 《Delphi》