求易语言MD5校验模块的源码!
答案:2 悬赏:70 手机版
解决时间 2021-01-30 12:27
- 提问者网友:人生佛魔见
- 2021-01-29 18:45
就是不需要支持库的那种!
最佳答案
- 五星知识达人网友:夜风逐马
- 2021-01-29 18:53
啧啧,hi你了,但不支持文本的,等文本的做好了给你
全部回答
- 1楼网友:过活
- 2021-01-29 20:15
(转载)
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "../md5/md5.h"
#define t1 0xd76aa478
#define t2 0xe8c7b756
#define t3 0x242070db
#define t4 0xc1bdceee
#define t5 0xf57c0faf
#define t6 0x4787c62a
#define t7 0xa8304613
#define t8 0xfd469501
#define t9 0x698098d8
#define t10 0x8b44f7af
#define t11 0xffff5bb1
#define t12 0x895cd7be
#define t13 0x6b901122
#define t14 0xfd987193
#define t15 0xa679438e
#define t16 0x49b40821
#define t17 0xf61e2562
#define t18 0xc040b340
#define t19 0x265e5a51
#define t20 0xe9b6c7aa
#define t21 0xd62f105d
#define t22 0x02441453
#define t23 0xd8a1e681
#define t24 0xe7d3fbc8
#define t25 0x21e1cde6
#define t26 0xc33707d6
#define t27 0xf4d50d87
#define t28 0x455a14ed
#define t29 0xa9e3e905
#define t30 0xfcefa3f8
#define t31 0x676f02d9
#define t32 0x8d2a4c8a
#define t33 0xfffa3942
#define t34 0x8771f681
#define t35 0x6d9d6122
#define t36 0xfde5380c
#define t37 0xa4beea44
#define t38 0x4bdecfa9
#define t39 0xf6bb4b60
#define t40 0xbebfbc70
#define t41 0x289b7ec6
#define t42 0xeaa127fa
#define t43 0xd4ef3085
#define t44 0x04881d05
#define t45 0xd9d4d039
#define t46 0xe6db99e5
#define t47 0x1fa27cf8
#define t48 0xc4ac5665
#define t49 0xf4292244
#define t50 0x432aff97
#define t51 0xab9423a7
#define t52 0xfc93a039
#define t53 0x655b59c3
#define t54 0x8f0ccc92
#define t55 0xffeff47d
#define t56 0x85845dd1
#define t57 0x6fa87e4f
#define t58 0xfe2ce6e0
#define t59 0xa3014314
#define t60 0x4e0811a1
#define t61 0xf7537e82
#define t62 0xbd3af235
#define t63 0x2ad7d2bb
#define t64 0xeb86d391
static void md5_process(md5_state_t *pms, const md5_byte_t *data )
{
md5_word_t
a = pms->abcd[0], b = pms->abcd[1],
c = pms->abcd[2], d = pms->abcd[3];
md5_word_t t;
#ifndef arch_is_big_endian
# define arch_is_big_endian 1
#endif
#if arch_is_big_endian
md5_word_t x[16];
const md5_byte_t *xp = data;
int i;
for (i = 0; i < 16; i, xp = 4)
x[i] = xp[0] (xp[1] << 8) (xp[2] << 16) (xp[3] << 24);
#else
md5_word_t xbuf[16];
const md5_word_t *x;
if (!((data - (const md5_byte_t *)0) & 3)) {
x = (const md5_word_t *)data;
} else {
memcpy(xbuf, data, 64);
x = xbuf;
}
#endif
#define rotate_left(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
#define f(x, y, z) (((x) & (y)) | (~(x) & (z)))
#define set(a, b, c, d, k, s, ti)\
t = a f(b,c,d) x[k] ti;\
a = rotate_left(t, s) b
set(a, b, c, d, 0, 7, t1);
set(d, a, b, c, 1, 12, t2);
set(c, d, a, b, 2, 17, t3);
set(b, c, d, a, 3, 22, t4);
set(a, b, c, d, 4, 7, t5);
set(d, a, b, c, 5, 12, t6);
set(c, d, a, b, 6, 17, t7);
set(b, c, d, a, 7, 22, t8);
set(a, b, c, d, 8, 7, t9);
set(d, a, b, c, 9, 12, t10);
set(c, d, a, b, 10, 17, t11);
set(b, c, d, a, 11, 22, t12);
set(a, b, c, d, 12, 7, t13);
set(d, a, b, c, 13, 12, t14);
set(c, d, a, b, 14, 17, t15);
set(b, c, d, a, 15, 22, t16);
#undef set
#define g(x, y, z) (((x) & (z)) | ((y) & ~(z)))
#define set(a, b, c, d, k, s, ti)\
t = a g(b,c,d) x[k] ti;\
a = rotate_left(t, s) b
set(a, b, c, d, 1, 5, t17);
set(d, a, b, c, 6, 9, t18);
set(c, d, a, b, 11, 14, t19);
set(b, c, d, a, 0, 20, t20);
set(a, b, c, d, 5, 5, t21);
set(d, a, b, c, 10, 9, t22);
set(c, d, a, b, 15, 14, t23);
set(b, c, d, a, 4, 20, t24);
set(a, b, c, d, 9, 5, t25);
set(d, a, b, c, 14, 9, t26);
set(c, d, a, b, 3, 14, t27);
set(b, c, d, a, 8, 20, t28);
set(a, b, c, d, 13, 5, t29);
set(d, a, b, c, 2, 9, t30);
set(c, d, a, b, 7, 14, t31);
set(b, c, d, a, 12, 20, t32);
#undef set
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯