高分求加密文件夹源代码或DLL

laishishenghust 2003-06-25 09:31:07
高分求加密文件夹源代码或DLL,分不够可以再加
laishisheng@sina.com
...全文
111 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
Robin 2003-09-12
  • 打赏
  • 举报
回复
db5
warton 2003-09-12
  • 打赏
  • 举报
回复
要写驱动吧,用文件模拟iso文件系统那样!
在驱动开发网去找找
xiaozhen666 2003-09-11
  • 打赏
  • 举报
回复
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>

typedef struct parm
{
char dir[128];
HANDLE hDir;
} THREAD_PARAM;

DWORD WINAPI thread(LPVOID lParam)
{
THREAD_PARAM *Par=(THREAD_PARAM *)lParam;
char notify[1024];
FILE_NOTIFY_INFORMATION *pnotify=(FILE_NOTIFY_INFORMATION *)notify;
char AnsiChar[3];
wchar_t UnicodeChar[2];
DWORD cbBytes;
printf("Watch [%s] start.\n",Par->dir);
while(true)
{
if(ReadDirectoryChangesW(Par->hDir,
¬ify,
sizeof(notify),
true,
FILE_NOTIFY_CHANGE_FILE_NAME|
FILE_NOTIFY_CHANGE_DIR_NAME|
FILE_NOTIFY_CHANGE_ATTRIBUTES|
FILE_NOTIFY_CHANGE_SIZE|
FILE_NOTIFY_CHANGE_LAST_WRITE|
FILE_NOTIFY_CHANGE_LAST_ACCESS|
FILE_NOTIFY_CHANGE_CREATION|
FILE_NOTIFY_CHANGE_SECURITY,
&cbBytes,
NULL,
NULL))
{
switch(pnotify->Action)
{
case FILE_ACTION_ADDED:
printf("Directory/File added - ");
break;
case FILE_ACTION_REMOVED:
printf("Directory/File removed - ");
break;
case FILE_ACTION_MODIFIED:
printf("Directory/File modified - ");
break;
case FILE_ACTION_RENAMED_OLD_NAME:
printf("Directory/File old name - ");
break;
case FILE_ACTION_RENAMED_NEW_NAME:
printf("Directory/File new name - ");
break;
}
printf("%s",Par->dir);
for(DWORD i=0;i<pnotify->FileNameLength/2;i++)
{
UnicodeChar[0]=pnotify->FileName[i];
UnicodeChar[1]=0;
ZeroMemory(AnsiChar,3);
WideCharToMultiByte(CP_ACP,0,UnicodeChar,-1,AnsiChar,3,NULL,NULL);
printf("%s",AnsiChar);
}
printf("\n");
}
}


}

int main(int argc,char **argv)
{
DWORD ThreadId;
THREAD_PARAM Par;
HANDLE hThread;
if(argc!=2)
{
printf("DirWatch <Directory>\n");
return 0;
}
lstrcpyn(Par.dir,argv[1],127);
Par.hDir = CreateFile(
Par.dir, // pointer to the file name
FILE_LIST_DIRECTORY, // access (read/write) mode
FILE_SHARE_READ|FILE_SHARE_DELETE, // share mode
NULL, // security descriptor
OPEN_EXISTING, // how to create
FILE_FLAG_BACKUP_SEMANTICS, // file attributes
NULL // file with attributes to copy
);
if(Par.hDir)
{
printf("Open Directory [%s] successfully.\n",Par.dir);

}
else
{
printf("Open Directory [%s] failed.\n",Par.dir);
return 0;
}
hThread=CreateThread(NULL,0,thread,(LPVOID *)&Par,0,&ThreadId);
if(hThread)
{
printf("CreateThread OK.\n");
printf("Press <q> to quit.\n");
while(getch()!='q');
TerminateThread(hThread,0);
WaitForSingleObject(hThread,1000);
CloseHandle(Par.hDir);
}
else
{
printf("CreateThread failed, the program exit.\n");
}

}
yesry 2003-09-03
  • 打赏
  • 举报
回复
上面只能加密单个文件,文件夹的打包同意netsys2
yesry 2003-09-03
  • 打赏
  • 举报
回复
#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 Rc5_w 32 /* word size in bits */
#define Rc5_r 12 /* number of rounds */
#define Rc5_b 16 /* number of bytes in key */
#define Rc5_c 4 /* number words in key = ceil(8*Rc5_b/Rc5_w)*/
#define Rc5_t 26 /* size of table Rc5_S = 2*(Rc5_r+1) words */
ENCRYTP_WORD Rc5_S[Rc5_t]; /* expanded key table */
ENCRYTP_WORD Rc5_P = 0xb7e15163, Rc5_Q = 0x9e3779b9; /* magic constants */
/* Rotation operators. x must be unsigned, to get logical right shift*/
#define ROTL(x,y) (((x)<<(y&(Rc5_w-1))) | ((x)>>(Rc5_w-(y&(Rc5_w-1)))))
#define ROTR(x,y) (((x)>>(y&(Rc5_w-1))) | ((x)<<(Rc5_w-(y&(Rc5_w-1)))))

void RC5_ENCRYPT(ENCRYTP_WORD *pt, ENCRYTP_WORD *ct) /* 2 ENCRYTP_WORD input pt/output ct */
{
ENCRYTP_WORD i, A=pt[0]+Rc5_S[0], B=pt[1]+Rc5_S[1];
for (i=1; i<=Rc5_r; i++)
{
A = ROTL(A^B,B)+Rc5_S[2*i];
B = ROTL(B^A,A)+Rc5_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=Rc5_r; i>0; i--)
{
B = ROTR(B-Rc5_S[2*i+1],A)^A;
A = ROTR(A-Rc5_S[2*i],B)^B;
}
pt[1] = B-Rc5_S[1]; pt[0] = A-Rc5_S[0];
}

void RC5_SETUP(unsigned char *K) /* secret input key K[0...Rc5_b-1] */
{
ENCRYTP_WORD u=Rc5_w/8, A, B, L[Rc5_c];
int i, j, k;
/* Initialize L, then Rc5_S, then mix key into Rc5_S */
for (i=Rc5_b-1,L[Rc5_c-1]=0;i!=-1; i--) L[i/u]= (L[i/u]<<8)+K[i];

for (Rc5_S[0]=Rc5_P,i=1; i<Rc5_t; i++)
Rc5_S[i] = Rc5_S[i-1]+Rc5_Q;
for (A=B=i=j=k=0; k<3*Rc5_t; k++,i=(i+1)%Rc5_t,j=(j+1)%Rc5_c) /* 3*Rc5_t > 3*Rc5_c */
{
A = Rc5_S[i] = ROTL(Rc5_S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
}
void Rc5Encrypt(unsigned char *Key,char *source,int source_len,char *target)
{
int word_count,effect_len;
unsigned char MyKey[16];
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];

memcpy(MyKey,Key,16);
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));
memcpy(MyKey,target+i*sizeof(ENCRYTP_WORD)*2,sizeof(ENCRYTP_WORD)*2);
RC5_SETUP(MyKey);
}
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;
unsigned char MyKey[16];
word_count=source_len/(sizeof(ENCRYTP_WORD)*2);
effect_len=source_len-word_count*(sizeof(ENCRYTP_WORD)*2);
int i,j;

memcpy(MyKey,Key,16);
RC5_SETUP(Key);
for(i=0;i<word_count;i++)
{
memcpy(MyKey,source+i*sizeof(ENCRYTP_WORD)*2,sizeof(ENCRYTP_WORD)*2);
RC5_DECRYPT((ENCRYTP_WORD *)(source+i*sizeof(ENCRYTP_WORD)*2),(ENCRYTP_WORD *)(target+i*sizeof(ENCRYTP_WORD)*2));
RC5_SETUP(MyKey);
}
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");
}

playguy 2003-09-03
  • 打赏
  • 举报
回复
可以去这里看一看,免费提供,绝对实用:
http://www.aslike.net
laishishenghust 2003-07-10
  • 打赏
  • 举报
回复
yesry()
分少可以再加呀,只要能解决问题,分是小事
laishishenghust 2003-07-06
  • 打赏
  • 举报
回复
我给你发过去了你收一下吧
yesry 2003-07-03
  • 打赏
  • 举报
回复
分太少啦。
yhz 2003-06-25
  • 打赏
  • 举报
回复
自己去找找吧!
http://www.turbopower.com

据说他现在免费供应了。
warton 2003-06-25
  • 打赏
  • 举报
回复
我一般用lockBox控件来加密,很方便!
zb007 2003-06-25
  • 打赏
  • 举报
回复
TurboPower网站的网址是多少阿
oldcold 2003-06-25
  • 打赏
  • 举报
回复
mark
laishishenghust 2003-06-25
  • 打赏
  • 举报
回复
我现在要做一个这样的程序,所以要用代码来实现
qibo999 2003-06-25
  • 打赏
  • 举报
回复
gz
netsys2 2003-06-25
  • 打赏
  • 举报
回复
这玩意你可以自己做,

先用ZIP控件压缩目录,得到一个文件。

然后调用算法加密这个文件。

在TurboPower网站上有加密的控件

13,826

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧