花生壳花生壳客户端完成[资料]

花生壳客户端  时间:2021-03-13  阅读:()

花生壳客户端实现

花生壳l i nux客户端源码(简易版)2006-10-25 14:41:58| 分类Linux | 标签 l inux 服务器 |字号大中小订阅.

花生壳l i nux客户端源码(简易版)

作者: lizhx新手上路(IPLogged)

日期: 2006-09-07 22:30:47

[原创]花生壳l i nux客户端源码(简易版)

花生壳很受欢迎

像我这样没有固定IP的人实在是没有办法只好请花生壳帮忙。又像我如此节约的人又不能开着电脑当服务器随便找个开发板就好了不到五瓦。

花生壳的l inux版客户端也不是没有就是不能在ARM LINUX下运行。

实在无奈之下就写了这么一个程序纯粹个人爱好。不好用 自己改改。md5.h

/* typedef a 32 bit type */typedef unsigned long int UINT4;

/* Data structure for MD5 (Message Digest) computation */typedef struct {

UINT4 i [2] ; /* number of_bits_handled mod 2^64 */

UINT4 buf[4] ; /* scratch buffer */unsigned char in[64] ; /* input buffer */unsigned char digest[16] ; /*actual digest after MD5Final call

*/

} MD 5_C TX;void MD5Init (MD5_CTX *mdContext) ;void MD5Update (MD5_CTX *mdContext,unsi gned char

*inBuf,unsigned int inLen) ;void MD5Final (unsigned char *digest,MD5_CTX *mdContext) ;void Transform (UINT4 *buf,UINT4 *in) ;void hmac_md5 (unsigned char*text, int text_len,unsigned char

* key, int key_len,unsigned char * digest) ;const char

BaseTab l e[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi j klmnopqrstuvwxyz0123456789+/=";char * DecodeBase64(char * Source) ;char * EncodeBase64(char * Source) ;unsigned char FindInTable(unsigned char) ;

//---------------------------------------------------------

------------------static unsigned char PADDING[64] = {

0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

} ;

/* F, G and H are basic MD5 functions: selection, majority,parity */

#define F(x, y, z) (((x) & (y)) | ((~x) & (z) ))

#define G(x, y, z) (((x) & (z)) | ((y) & (~z) ))

#define H(x, y, z) ((x) ^ (y) ^ (z))

#define I(x, y, z) ((y) ^ ((x) | (~z)))

/* ROTATE_LEFT rotates x left n bits */

#def ine ROTATE_LEFT(x, n) (( (x) << (n) ) | ((x) >> (32-(n)) ))/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and4 */

/*Rotation is separate from addition to prevent recomputation

*/

#def ine FF(a, b, c, d, x, s, ac) { (a) += F ( (b) , (c) , (d) ) +(x) + (U INT4) (ac) ; (a) =ROTATE_LEFT ( (a) , (s)) ; (a) += (b) ; }#def ine GG(a, b, c, d, x, s, ac) { (a) += G ((b) , (c) , (d) ) +(x) + (U INT4) (ac) ; (a) =ROTATE_LEFT ( (a) , (s)) ; (a) += (b) ; }#def ine HH(a, b, c, d, x, s, ac) { (a) += H ((b) , (c) , (d) ) +(x) + (U INT4) (ac) ; (a) =ROTATE_LEFT ( (a) , (s)) ; (a) += (b) ; }#define II(a, b, c, d, x, s, ac) { (a) += I ((b) , (c) , (d) ) +(x) + (U INT4) (ac) ; (a) =ROTATE_LEFT ( (a) , (s)) ; (a) += (b) ; }//---------------------------------------------------------

------------------

void MD5Init (MD5_CTX * mdContext)

{mdContext->i[0] = mdContext->i[1] = (UINT4)0;

/* Load magic initialization constants.

*/mdContext->buf[0] = (UINT4)0x67452301;mdContext->buf[1] = (UINT4)0xefcdab89;mdContext->buf[2] = (UINT4)0x98badcf e;mdContext->buf[3] = (UINT4)0x10325476;

}

//---------------------------------------------------------

------------------void MD5Update (MD5_CTX *mdContext, uns igned char *inBuf,unsigned int inLen)

{

UINT4 in[16] ;int mdi ;unsigned int i, ii;

/* compute number of bytes mod 64 */mdi = (int) ((mdContext->i [0] >> 3) & 0x3F) ;

/* update number of bits */if ((mdContext->i [0] + ( (UINT4) inLen<< 3) ) <mdContext->i[0])mdContext->i[1]++;mdContext->i[0] += ((UINT4) inLen << 3) ;mdContext->i[1] += ((UINT4) inLen >> 29) ;while (inLen--) {

/* add new character to buffer, increment mdi */mdContext->in[mdi++] = *i nBuf++;

/* transform if necessary */i f (mdi == 0x40) {for (i = 0, ii = 0; i < 16; i++, ii += 4)in[i] = (( (UINT4)mdContext->in[ii+3] ) << 24) |

( ((UINT4)mdContext->in[ii+2] ) << 16) |

( ((UINT4)mdContext->in[ii+1] ) << 8) |

( (UINT4)mdContext->in[i i] ) ;

Transform (mdContext->buf, in) ;mdi = 0;

}

}

}

//---------------------------------------------------------

void MD5Final (unsigned char *digest,MD5_CTX *mdContext){

UINT4 in[16] ;int mdi ;unsigned int i, ii;unsigned int padLen;

/* save number of bits */in[14] = mdContext->i[0] ;in[15] = mdContext->i[1] ;

/* compute number of bytes mod 64 */mdi = (int) ((mdContext->i [0] >> 3) & 0x3F) ;

/* pad out to 56 mod 64 */padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi) ;

MD5Update (mdContext, PADDING, padLen) ;

/* append length in bits and transform */for (i = 0, ii = 0; i < 14; i++, ii += 4)in[i] = (( (UINT4)mdContext->in[ii+3] ) << 24) |

( ((UINT4)mdContext->in[ii+2] ) << 16) |

( ((UINT4)mdContext->in[ii+1] ) << 8) |

( (UINT4)mdContext->in[i i] ) ;

Transform (mdContext->buf, in) ;

/* store buffer in digest */for (i = 0, ii = 0; i < 4; i++, ii += 4) {mdContext->digest[i i] = (unsigned char) (mdContext->buf[i] &0 xFF) ;mdContext->digest[ii+1] =

(unsigned char) ( (mdContext->buf[i] >> 8) & 0xFF) ;mdContext->digest[ii+2] =

(uns igned char) ( (mdContext->buf[i] >> 16) & 0xFF) ;mdContext->digest[ii+3] =

(uns igned char) ( (mdContext->buf[i] >> 24) & 0xFF) ;

}

memcpy(digest,mdContext->buf, 16) ;

}

//---------------------------------------------------------

------------------

/* Basic MD5 step. Transform buf based on in.

*/void Transform (UINT4 *buf, UINT4 *in)

{

UINT4 a = buf[0] , b = buf[1], c = buf[2], d = buf[3] ;/* Round 1 */

#define S11 7

#define S12 12

#define S13 17

#define S14 22

FF ( a, b, c, d, in[ 0] , S 11, 3614090360UL) ; /* 1 */

FF ( d, a, b, c, in[ 1] , S 12, 3905402710UL) ; /* 2 */

FF ( c, d, a, b, in[ 2], S13, 606105819UL) ; /* 3 */

FF ( b, c, d, a, in[ 3] , S 14, 3250441966UL) ; /* 4 */

FF ( a, b, c, d, in[ 4] , S 11, 4118548399UL) ; /* 5 */

FF ( d, a, b, c, in[ 5] , S 12, 1200080426UL) ; /* 6 */

FF ( c, d, a, b, in[ 6] , S 13, 2821735955UL) ; /* 7 */FF ( b, c, d, a, in[ 7] , S 14, 4249261313UL) ; /* 8 */FF ( a, b, c, d, in[ 8] , S 11, 1770035416UL) ; /* 9 */FF ( d, a, b, c, in[ 9] , S12, 2336552879UL) ; /* 10 */FF ( c, d, a, b, in[10] , S13, 4294925233UL) ; /* 11 */FF ( b, c, d, a, in[11] , S14, 2304563134UL) ; /* 12 */FF ( a, b, c, d, in[12] , S11, 1804603682UL) ; /* 13 */FF ( d, a, b, c, in[13] , S12, 4254626195UL) ; /* 14 */FF ( c, d, a, b, in[14] , S13, 2792965006UL) ; /* 15 */FF ( b, c, d, a, in[15] , S14, 1236535329UL) ; /* 16 *//* Round 2 */

#define S21 5

#define S22 9

#define S23 14

#define S24 20

GG ( a, b, c, d, in[ 1] , S21, 4129170786UL) ; /* 17 */GG ( d, a, b, c, in[ 6] , S22, 3225465664UL) ; /* 18 */

vpsdime7美元/月,美国达拉斯Windows VPS,2核4G/50GB SSD/2TB流量/Hyper-V虚拟化

vpsdime怎么样?vpsdime是2013年成立的国外VPS主机商,以大内存闻名业界,主营基于OpenVZ和KVM虚拟化的Linux套餐,大内存、10Gbps大带宽、大硬盘,有美国西雅图、达拉斯、新泽西、英国、荷兰机房可选。在上个月搞了一款达拉斯Linux系统VPS促销,详情查看:vpsdime夏日促销活动,美国达拉斯vps,2G内存/2核/20gSSD/1T流量,$20/年,此次推出一款Wi...

CloudCone($82/月)15-100M不限流量,洛杉矶CN2 GIA线路服务器

之前分享过很多次CloudCone的信息,主要是VPS主机,其实商家也提供独立服务器租用,同样在洛杉矶MC机房,分为两种线路:普通优化线路及CN2 GIA,今天来分享下商家的CN2 GIA线路独立服务器产品,提供15-100Mbps带宽,不限制流量,可购买额外的DDoS高防IP,最低每月82美元起,支持使用PayPal或者支付宝等付款方式。下面分享几款洛杉矶CN2 GIA线路独立服务器配置信息。配...

3C云1核1G 9.9元 4核4G 16元 美国Cera 2核4G 24元

3C云互联怎么样?3C云互联专注免备案香港美国日本韩国台湾云主机vps服务器,美国高防CN2GIA,香港CN2GIA,顶级线路优化,高端品质售后无忧!致力于对互联网云计算科技深入研发与运营的极客共同搭建而成,将云计算与网络核心技术转化为最稳定,安全,高速以及极具性价比的云服务器等产品提供给用户!专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松...

花生壳客户端为你推荐
brandoff淘宝上的代购奢侈品都是真品吗?敬汉卿姓名被抢注12306身份证名字被注册怎么办怎么查询商标怎样查询商标有没有被注册方法有哪些?rawtools相机中的RAW是什么意思?www.qq530.com谁能给我一个听歌的网站?avtt4.comCOM1/COM3/COM4是什么意思??/www.kknnn.com求有颜色的网站!要免费的www.bbb551.com100bbb网站怎样上不去了dadi.tvapple TV 功能介绍javlibrary.comsony home network library官方下载地址
游戏服务器租用 20g硬盘 双12活动 云图标 网盘申请 好看qq空间 骨干网络 hostloc cn3 爱奇艺vip免费试用7天 美国在线代理服务器 1美金 t云 台湾谷歌 新睿云 web服务器是什么 ebay注册 存储服务器 杭州电信宽带 789电视剧网 更多