快讯

在BMP文件中隐藏信息

2004-02-14 09:34  出处:PConline  作者:网上收集  责任编辑:zwg 

/*************************** ENCRYPTION ROUTINES ***********************/ int hash_func(unsigned char* password) { /* This hash function steps thru the string, storing the */ /* lowest 4 bits, and shifting the running total left 4 bits */ /* The shift is a rotational one, e.g. the top nibble comes */ /* back in the bottom (LSB) nibble */ unsigned int hash_ttl=0; unsigned int ptr=0; char this_chr; while (password[ptr] != '\0') { /* Step through string one char at a time */ this_chr=password[ptr++]; /* Add lowest 4 bits of character */ hash_ttl=hash_ttl + (this_chr & 0x0f); /* Rotate hash total 4 bits to left (to MSB) */ hash_ttl = rotl4 (hash_ttl); } return (hash_ttl); } int rotl4(int inval) { /* Rotate 16bit integer INVAL left by 4 bits */ unsigned int result; unsigned int tmp; tmp = inval & 0xf000; /* MSB nibble of the 4 */ result = inval & 0xfff; /* 3 LSB nibbles of the 4 */ result < < = 4; /* Shift nibs 2-0 to 3-1 posns */ tmp > >= 12; /* Shift nib 3 to nib 0 posn */ result = result + tmp; /* Add nib 0 into 3-1 value */ return (result); } void cryptoData(HEAP* data, unsigned char* password) { unsigned long int i; unsigned int passhash; unsigned char pupper,plower; int alternhash=FALSE; passhash=hash_func(password); pupper=passhash&0xff00; plower=passhash&0xff; *(data- >dataspace+1)='E'; for (i=7; i< data- >heaplen; i++) { if (alternhash) { *(data- >dataspace+i)=xor(*(data- >dataspace+i),pupper); alternhash=FALSE; } else { *(data- >dataspace+i)=xor(*(data- >dataspace+i),plower); alternhash=TRUE; } } } unsigned char xor(unsigned char A, unsigned char B) { unsigned char t1,t2,t3; t1=A|B; t2=A&B; t3=t1-t2; return ~t3; }
键盘也能翻页,试试“← →”键
IT热词搜索 来源:360新闻
软件论坛帖子排行
相关文章

相关软件:

腾讯QQ2012
大小:52.93 MB 授权:免费
腾讯QQ2012
立即下载
腾讯QQ2013
大小:49.32 MB 授权:免费
腾讯QQ2013
立即下载