12 个解决方案
#1
找我没错^_^
我有很完整的C源代码
huanghaiheng@163.net
我有很完整的C源代码
huanghaiheng@163.net
#2
to mme(dog):
能否发到我的邮箱中?
law@longda.com.cn
能否发到我的邮箱中?
law@longda.com.cn
#3
aelord@yzvod.com
#4
网上有很多,搜索一下,下也下不完
#5
如果要简单的话,使用lockbox控件,很方便!
#6
我已经发过去啦!
给分的时候记得给一点我啊!
给分的时候记得给一点我啊!
#7
lockbox控件????????????????还真没用过~~~发一个给俺~~:)
chulon@yeah.net
谢谢~
chulon@yeah.net
谢谢~
#8
要说c的加解密源代码这里有很多
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
不过好像要改改才能在BCB里用
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
不过好像要改改才能在BCB里用
#9
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef unsigned long int ENCRYTP_WORD; /* Should be 32-bit = 4 bytes */
#define w 32 /* word size in bits */
#define r 12 /* number of rounds */
#define b 16 /* number of bytes in key */
#define c 4 /* number words in key = ceil(8*b/w)*/
#define t 26 /* size of table S = 2*(r+1) words */
ENCRYTP_WORD S[t]; /* expanded key table */
ENCRYTP_WORD P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */
/* Rotation operators. x must be unsigned, to get logical right shift*/
#define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
#define ROTR(x,y) (((x)>>(y&(w-1))) | ((x)<<(w-(y&(w-1)))))
void RC5_ENCRYPT(ENCRYTP_WORD *pt, ENCRYTP_WORD *ct) /* 2 ENCRYTP_WORD input pt/output ct */
{
ENCRYTP_WORD i, A=pt[0]+S[0], B=pt[1]+S[1];
for (i=1; i<=r; i++)
{
A = ROTL(A^B,B)+S[2*i];
B = ROTL(B^A,A)+S[2*i+1];
}
ct[0] = A; ct[1] = B;
}
void RC5_DECRYPT(ENCRYTP_WORD *ct, ENCRYTP_WORD *pt) /* 2 ENCRYTP_WORD input ct/output pt */
{
ENCRYTP_WORD i, B=ct[1], A=ct[0];
for (i=r; i>0; i--)
{
B = ROTR(B-S[2*i+1],A)^A;
A = ROTR(A-S[2*i],B)^B;
}
pt[1] = B-S[1]; pt[0] = A-S[0];
}
void RC5_SETUP(unsigned char *K) /* secret input key K[0...b-1] */
{
ENCRYTP_WORD u=w/8, A, B, L[c];
int i, j, k;
/* Initialize L, then S, then mix key into S */
for (i=b-1,L[c-1]=0;i!=-1; i--) L[i/u]= (L[i/u]<<8)+K[i];
for (S[0]=P,i=1; i<t; i++)
S[i] = S[i-1]+Q;
for (A=B=i=j=k=0; k<3*t; k++,i=(i+1)%t,j=(j+1)%c) /* 3*t > 3*c */
{
A = S[i] = ROTL(S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
randomize();
}
void Rc5Encrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
ENCRYTP_WORD w1[2];
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_ENCRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void Rc5Decrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_DECRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void main(int argc, char * argv[])
{
char *buff,*buff2;
int len1;
if(argc<2)return;
FILE *file=fopen(argv[1],"rb");
if(file==NULL)return;
printf("1");
fseek(file,0,SEEK_END);
len1=ftell(file);
fseek(file,0,SEEK_SET);
buff=new char[len1+10];
buff2=new char[len1+10];
fread(buff,len1,1,file);
fclose(file);
file=fopen(argv[2],"w+b");
if(file==NULL)return;
printf("1");
Rc5Encrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff,len1,buff2);
fwrite(buff2,len1,1,file);
fclose(file);
memset(buff,0,len1);
file=fopen(argv[3],"w+b");
if(file==NULL)return;
Rc5Decrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff2,len1,buff);
fwrite(buff,len1,1,file);
fclose(file);
delete buff;
delete buff2;
printf("ok");
}
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef unsigned long int ENCRYTP_WORD; /* Should be 32-bit = 4 bytes */
#define w 32 /* word size in bits */
#define r 12 /* number of rounds */
#define b 16 /* number of bytes in key */
#define c 4 /* number words in key = ceil(8*b/w)*/
#define t 26 /* size of table S = 2*(r+1) words */
ENCRYTP_WORD S[t]; /* expanded key table */
ENCRYTP_WORD P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */
/* Rotation operators. x must be unsigned, to get logical right shift*/
#define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
#define ROTR(x,y) (((x)>>(y&(w-1))) | ((x)<<(w-(y&(w-1)))))
void RC5_ENCRYPT(ENCRYTP_WORD *pt, ENCRYTP_WORD *ct) /* 2 ENCRYTP_WORD input pt/output ct */
{
ENCRYTP_WORD i, A=pt[0]+S[0], B=pt[1]+S[1];
for (i=1; i<=r; i++)
{
A = ROTL(A^B,B)+S[2*i];
B = ROTL(B^A,A)+S[2*i+1];
}
ct[0] = A; ct[1] = B;
}
void RC5_DECRYPT(ENCRYTP_WORD *ct, ENCRYTP_WORD *pt) /* 2 ENCRYTP_WORD input ct/output pt */
{
ENCRYTP_WORD i, B=ct[1], A=ct[0];
for (i=r; i>0; i--)
{
B = ROTR(B-S[2*i+1],A)^A;
A = ROTR(A-S[2*i],B)^B;
}
pt[1] = B-S[1]; pt[0] = A-S[0];
}
void RC5_SETUP(unsigned char *K) /* secret input key K[0...b-1] */
{
ENCRYTP_WORD u=w/8, A, B, L[c];
int i, j, k;
/* Initialize L, then S, then mix key into S */
for (i=b-1,L[c-1]=0;i!=-1; i--) L[i/u]= (L[i/u]<<8)+K[i];
for (S[0]=P,i=1; i<t; i++)
S[i] = S[i-1]+Q;
for (A=B=i=j=k=0; k<3*t; k++,i=(i+1)%t,j=(j+1)%c) /* 3*t > 3*c */
{
A = S[i] = ROTL(S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
randomize();
}
void Rc5Encrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
ENCRYTP_WORD w1[2];
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_ENCRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void Rc5Decrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_DECRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void main(int argc, char * argv[])
{
char *buff,*buff2;
int len1;
if(argc<2)return;
FILE *file=fopen(argv[1],"rb");
if(file==NULL)return;
printf("1");
fseek(file,0,SEEK_END);
len1=ftell(file);
fseek(file,0,SEEK_SET);
buff=new char[len1+10];
buff2=new char[len1+10];
fread(buff,len1,1,file);
fclose(file);
file=fopen(argv[2],"w+b");
if(file==NULL)return;
printf("1");
Rc5Encrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff,len1,buff2);
fwrite(buff2,len1,1,file);
fclose(file);
memset(buff,0,len1);
file=fopen(argv[3],"w+b");
if(file==NULL)return;
Rc5Decrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff2,len1,buff);
fwrite(buff,len1,1,file);
fclose(file);
delete buff;
delete buff2;
printf("ok");
}
#10
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
有很多c的,不过bcb想用还要改改
有很多c的,不过bcb想用还要改改
#11
to : yesry(眼球经济)
你的方法如果有汉字的话不好用!
你的方法如果有汉字的话不好用!
#12
谢谢以上各位
#1
找我没错^_^
我有很完整的C源代码
huanghaiheng@163.net
我有很完整的C源代码
huanghaiheng@163.net
#2
to mme(dog):
能否发到我的邮箱中?
law@longda.com.cn
能否发到我的邮箱中?
law@longda.com.cn
#3
aelord@yzvod.com
#4
网上有很多,搜索一下,下也下不完
#5
如果要简单的话,使用lockbox控件,很方便!
#6
我已经发过去啦!
给分的时候记得给一点我啊!
给分的时候记得给一点我啊!
#7
lockbox控件????????????????还真没用过~~~发一个给俺~~:)
chulon@yeah.net
谢谢~
chulon@yeah.net
谢谢~
#8
要说c的加解密源代码这里有很多
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
不过好像要改改才能在BCB里用
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
不过好像要改改才能在BCB里用
#9
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef unsigned long int ENCRYTP_WORD; /* Should be 32-bit = 4 bytes */
#define w 32 /* word size in bits */
#define r 12 /* number of rounds */
#define b 16 /* number of bytes in key */
#define c 4 /* number words in key = ceil(8*b/w)*/
#define t 26 /* size of table S = 2*(r+1) words */
ENCRYTP_WORD S[t]; /* expanded key table */
ENCRYTP_WORD P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */
/* Rotation operators. x must be unsigned, to get logical right shift*/
#define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
#define ROTR(x,y) (((x)>>(y&(w-1))) | ((x)<<(w-(y&(w-1)))))
void RC5_ENCRYPT(ENCRYTP_WORD *pt, ENCRYTP_WORD *ct) /* 2 ENCRYTP_WORD input pt/output ct */
{
ENCRYTP_WORD i, A=pt[0]+S[0], B=pt[1]+S[1];
for (i=1; i<=r; i++)
{
A = ROTL(A^B,B)+S[2*i];
B = ROTL(B^A,A)+S[2*i+1];
}
ct[0] = A; ct[1] = B;
}
void RC5_DECRYPT(ENCRYTP_WORD *ct, ENCRYTP_WORD *pt) /* 2 ENCRYTP_WORD input ct/output pt */
{
ENCRYTP_WORD i, B=ct[1], A=ct[0];
for (i=r; i>0; i--)
{
B = ROTR(B-S[2*i+1],A)^A;
A = ROTR(A-S[2*i],B)^B;
}
pt[1] = B-S[1]; pt[0] = A-S[0];
}
void RC5_SETUP(unsigned char *K) /* secret input key K[0...b-1] */
{
ENCRYTP_WORD u=w/8, A, B, L[c];
int i, j, k;
/* Initialize L, then S, then mix key into S */
for (i=b-1,L[c-1]=0;i!=-1; i--) L[i/u]= (L[i/u]<<8)+K[i];
for (S[0]=P,i=1; i<t; i++)
S[i] = S[i-1]+Q;
for (A=B=i=j=k=0; k<3*t; k++,i=(i+1)%t,j=(j+1)%c) /* 3*t > 3*c */
{
A = S[i] = ROTL(S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
randomize();
}
void Rc5Encrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
ENCRYTP_WORD w1[2];
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_ENCRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void Rc5Decrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_DECRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void main(int argc, char * argv[])
{
char *buff,*buff2;
int len1;
if(argc<2)return;
FILE *file=fopen(argv[1],"rb");
if(file==NULL)return;
printf("1");
fseek(file,0,SEEK_END);
len1=ftell(file);
fseek(file,0,SEEK_SET);
buff=new char[len1+10];
buff2=new char[len1+10];
fread(buff,len1,1,file);
fclose(file);
file=fopen(argv[2],"w+b");
if(file==NULL)return;
printf("1");
Rc5Encrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff,len1,buff2);
fwrite(buff2,len1,1,file);
fclose(file);
memset(buff,0,len1);
file=fopen(argv[3],"w+b");
if(file==NULL)return;
Rc5Decrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff2,len1,buff);
fwrite(buff,len1,1,file);
fclose(file);
delete buff;
delete buff2;
printf("ok");
}
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef unsigned long int ENCRYTP_WORD; /* Should be 32-bit = 4 bytes */
#define w 32 /* word size in bits */
#define r 12 /* number of rounds */
#define b 16 /* number of bytes in key */
#define c 4 /* number words in key = ceil(8*b/w)*/
#define t 26 /* size of table S = 2*(r+1) words */
ENCRYTP_WORD S[t]; /* expanded key table */
ENCRYTP_WORD P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */
/* Rotation operators. x must be unsigned, to get logical right shift*/
#define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
#define ROTR(x,y) (((x)>>(y&(w-1))) | ((x)<<(w-(y&(w-1)))))
void RC5_ENCRYPT(ENCRYTP_WORD *pt, ENCRYTP_WORD *ct) /* 2 ENCRYTP_WORD input pt/output ct */
{
ENCRYTP_WORD i, A=pt[0]+S[0], B=pt[1]+S[1];
for (i=1; i<=r; i++)
{
A = ROTL(A^B,B)+S[2*i];
B = ROTL(B^A,A)+S[2*i+1];
}
ct[0] = A; ct[1] = B;
}
void RC5_DECRYPT(ENCRYTP_WORD *ct, ENCRYTP_WORD *pt) /* 2 ENCRYTP_WORD input ct/output pt */
{
ENCRYTP_WORD i, B=ct[1], A=ct[0];
for (i=r; i>0; i--)
{
B = ROTR(B-S[2*i+1],A)^A;
A = ROTR(A-S[2*i],B)^B;
}
pt[1] = B-S[1]; pt[0] = A-S[0];
}
void RC5_SETUP(unsigned char *K) /* secret input key K[0...b-1] */
{
ENCRYTP_WORD u=w/8, A, B, L[c];
int i, j, k;
/* Initialize L, then S, then mix key into S */
for (i=b-1,L[c-1]=0;i!=-1; i--) L[i/u]= (L[i/u]<<8)+K[i];
for (S[0]=P,i=1; i<t; i++)
S[i] = S[i-1]+Q;
for (A=B=i=j=k=0; k<3*t; k++,i=(i+1)%t,j=(j+1)%c) /* 3*t > 3*c */
{
A = S[i] = ROTL(S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
randomize();
}
void Rc5Encrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
ENCRYTP_WORD w1[2];
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_ENCRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void Rc5Decrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
RC5_DECRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
}
for(j=0;j<effect_len;j++)
{
*(target+word_count*sizeof(ENCRYTP_WORD)*2+j)=
*(source+word_count*sizeof(ENCRYTP_WORD)*2+j)^Key[9];
}
}
void main(int argc, char * argv[])
{
char *buff,*buff2;
int len1;
if(argc<2)return;
FILE *file=fopen(argv[1],"rb");
if(file==NULL)return;
printf("1");
fseek(file,0,SEEK_END);
len1=ftell(file);
fseek(file,0,SEEK_SET);
buff=new char[len1+10];
buff2=new char[len1+10];
fread(buff,len1,1,file);
fclose(file);
file=fopen(argv[2],"w+b");
if(file==NULL)return;
printf("1");
Rc5Encrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff,len1,buff2);
fwrite(buff2,len1,1,file);
fclose(file);
memset(buff,0,len1);
file=fopen(argv[3],"w+b");
if(file==NULL)return;
Rc5Decrypt("fnw erhwerqjr03982 u3i j1;23r 01238",
buff2,len1,buff);
fwrite(buff,len1,1,file);
fclose(file);
delete buff;
delete buff2;
printf("ok");
}
#10
http://www.vckbase.com/code/listcode.asp?mclsid=1&sclsid=109
有很多c的,不过bcb想用还要改改
有很多c的,不过bcb想用还要改改
#11
to : yesry(眼球经济)
你的方法如果有汉字的话不好用!
你的方法如果有汉字的话不好用!
#12
谢谢以上各位