admin管理员组文章数量:1568557
2024年3月21日发(作者:)
/*
从网上找的内嵌汇编的MD5代码,,bcb6下面调试通过。
优点是速度很快,缺点是只能在Windows下使用。
最后面有现成的 for bcb 的两个函数。
*/
#include
#include
////////////////////////////////////////////////////////////////////////////////
typedef struct {
DWORD state[4]; //encypted message
DWORD count[2]; //bits of plaintext
unsigned char buffer[64];
}MD5_CTX;
////////////////////////////////////////////////////////////////////////////////
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
#define a esi
#define b edi
#define c edx
#define d ebx
#define tmp1 eax
#define tmp2 ecx
#define x(i) [x+4*i]
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define FF(a, b, c, d, x, s, ac)
__asm mov tmp1,b;
__asm and tmp1,c;
__asm mov tmp2,b;
__asm not tmp2;
__asm and tmp2,d;
__asm or tmp2,tmp1;
__asm lea a,[tmp2+a+ac];
__asm add a,x;
__asm rol a,s;
__asm add a,b;
#define GG(a, b, c, d, x, s, ac)
__asm mov tmp1,b;
__asm and tmp1,d;
__asm mov tmp2,d;
__asm not tmp2;
__asm and tmp2,c;
__asm or tmp2,tmp1;
__asm lea a,[tmp2+a+ac];
__asm add a,x;
__asm rol a,s;
__asm add a,b;
#define HH(a,b,c, d, x, s, ac)
__asm mov tmp2,b;
__asm xor tmp2,c;
__asm xor tmp2,d;
__asm lea a,[tmp2+a+ac];
__asm add a,x;
__asm rol a,s;
__asm add a,b;
#define II(a, b, c, d, x, s, ac)
版权声明:本文标题:MD5的代码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1711012665a295150.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论