⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hzg.bak

📁 你可以做个试试看,我是做了一个,有感觉
💻 BAK
字号:
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
#include <io.h>
#include <stdlib.h>

void main()
{
	unsigned w1;
	long c1;
	int length;
	FILE *fpc,*fpw,*fp,*fpy,*fpyy,*fpyyy;
	int i,j,num;
	char *in,key[150],temp[10],ch[2];
	char *buff,*buff0;

	if((fp=fopen("hy.dat","w"))==NULL)
	{
		printf("can not open the file of 'hy.bat'\n");
		//delay(2000);
		exit(1);
	}
	if((fpy=fopen("hy.txt","w"))==NULL)
	{
		printf("can not open the file of 'hy.txt'\n");
		//delay(2000);
		exit(1);
	}
	if((fpyy=fopen("hyy.txt","w"))==NULL)
	{
		printf("can not open the file of 'hyy.txt'\n");
		//delay(2000);
		exit(1);
	}
	if((fpyyy=fopen("hyyy.txt","w"))==NULL)
	{
		printf("can not open the file of 'hyyy.txt'\n");
		//delay(2000);
		exit(1);
	}
	printf("Please input the words\n");
	gets(key);
	length=strlen(key);
	in=key;
	if((buff=(char*)malloc(length*16))==NULL)
	{
		printf("alloc ERROR");
//		delay(2000);
		exit(1);
	}
	buff0=buff;
	if((fpw=fopen("asc16g","rb"))==NULL)
	{
		printf("Can not open the file of 'asc16g'\n");
//		delay(2000);
		exit(1);
	}
	if((fpc=fopen("hzk16g","rb"))==NULL)
	{
		printf("Can not open the file of 'hzk16g'\n");
//		delay(2000);
		exit(1);
	}
	i=0;
	while(*in)
	{
		if(*in>0)
		{
			w1=16*(*in);
//			*(buff+i)=0;
//			*(buff+i+15*length)=0;
		printf("%d \n ",*in);
		printf("%d \n ",w1);
			fseek(fpw,w1,0);
//			for(j=1;j<15;++j)
//				fread(buff+i+j*length,1,1,fpw);
			for(j=0;j<8;++j)
				fread(buff+16*i+2*j,1,1,fpw);
			for(j=8;j<16;++j)
				fread(buff+16*i+2*(j-8)+1,1,1,fpw);
			in++;
			i++;

/*		 for(i=0;i<256;i++){
			w1=16*i;
//			*(buff+i)=0;
//			*(buff+i+15*length)=0;
			fseek(fpw,w1,0);
//			for(j=1;j<15;++j)
//				fread(buff+i+j*length,1,1,fpw);
			for(j=0;j<8;++j)
				fread(buff+16*i+2*j,1,1,fpw);
			for(j=8;j<16;++j)
				fread(buff+16*i+2*(j-8)+1,1,1,fpw);}
		   in++;
//*/
		}
		else
		{
			c1=(long)((*in+95)*94+(*(in+1)+95))*32;
			fseek(fpc,c1,0);
			for(j=0;j<16;++j){
//				fread(buff+i+j*length,2,1,fpc);
//				ch[0]=buff[i+j*length];
//				ch[1]=buff[i+j*length+1];
 //				buff[i+j*length]=ch[1];
//				buff[i+j*length+1]=ch[0];
				fread(ch,2,1,fpc);
				buff[i*16+j]=ch[0];       //1
				buff[(i+1)*16+j]=ch[1];   //0
				}

			in+=2;
			i+=2;
		}
	}

	buff=buff0;
	fwrite(buff,16*length,1,fp);
//	for(i=0;i<256;i++)
	for(i=0;i<length;i++)
	{
	    fwrite("DB 0",4,1,fpy);
	    for(j=0;j<16;j++){
		printf("%02x ",buff[16*i+j]);
		num=~((int)buff[16*i+j]);
		sprintf(temp,"%02x",num);
		if(temp[0]<='9')
		    fwrite(temp,2,1,fpy);
		else
		    fwrite(&temp[2],2,1,fpy);
		if(j==15)
		    fwrite("H",1,1,fpy);
		else
		    fwrite("H, 0",4,1,fpy);
	    }
	    printf("\n");
	    fwrite("\n",1,1,fpy);
	}

	buff=buff0;
	fwrite(buff,16*length,1,fp);
	//	for(i=0;i<256;i++)
	for(j=0;j<16;j++)
	{
	    fwrite("DB 0",4,1,fpyy);
	  for(i=0;i<length;i++) {
		printf("%02x ",buff[16*i+j]); //16*i+j
		num=~((int)buff[16*i+j]);        //16*i+j
		sprintf(temp,"%02x",num);
		if(temp[0]<='9')
		    fwrite(temp,2,1,fpyy);
		else
		    fwrite(&temp[2],2,1,fpyy);
		if(i==length-1)
		    fwrite("H",1,1,fpyy);
		else
		    fwrite("H, 0",4,1,fpyy);
	  }
	    printf("\n");
	    fwrite("\n",1,1,fpyy);
	}

	buff=buff0;
	fwrite(buff,16*length,1,fp);
	//	for(i=0;i<256;i++)
	for(j=0;j<16;j++)
	{
	    fwrite("DB 0",4,1,fpyyy);
	  for(i=length-1;i>=0;i--) {
		printf("%02x ",buff[16*i+j]);
		num=(int)buff[16*i+j];
		sprintf(temp,"%02x",num);
		if(temp[0]<='9')
		    fwrite(temp,2,1,fpyyy);
		else
		    fwrite(&temp[2],2,1,fpyyy);
		if(i==0)
		    fwrite("H",1,1,fpyyy);
		else
		    fwrite("H, 0",4,1,fpyyy);
	  }
	    printf("\n");
	    fwrite("\n",1,1,fpyyy);
	}
	fclose(fpw);
	fclose(fpc);
	fclose(fp);
	fclose(fpyy);
	fclose(fpyyy);
	fclose(fpy);
	free(buff);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -