1.js 压缩后的源码代码如何调试?
2.C++ä¸å¦ä½è°ç¨zlib.dllè¿è¡è§£ååå缩
3.请问有没有LZW压缩算法的源代码?
js 压缩后的代码如何调试?
我想你问的是不是类似UglifyJS之类的混淆过的JS代码?这种压缩通常会把变量、函数名之类的解析改成非常短的名称,因此这种压缩过的源码代码就难以识别了。对于这种代码,解析推荐的源码tidb 源码开发语言思路是先看浏览器中是否有报错,然后根据错误来判断自己原始代码里可能出错的解析泡泡语音app源码位置;如果没有报错,那也是源码断定大概的位置,然后Chrome里打开开发者工具里的解析Sources,打开自己的源码代码,用这个地方可以对代码进行重新排版:
当然,解析如果是源码uglify过的代码还是很难看,只能根据自己实际代码里的解析一些常量内容作为关键词在浏览器的代码里面搜自己可能的位置,然后加断点推测去调试。源码vt调试驱动源码
上面的解析办法,都是源码在你对压缩JS这个过程没有控制的情况下,如果是你自己压缩JS代码,可以在压缩的剑灵革命 源码时候同时生成sourcemap文件,一般是xxx.js.map文件。如果连同这个文件一起部署,那么在开发者工具中打开的时候,也可以看到最原始的源码行业新闻代码了。这是最推荐的办法,调试起来也是最轻松的。
C++ä¸å¦ä½è°ç¨zlib.dllè¿è¡è§£ååå缩
1 åå¤å·¥ä½ã
ä¸è½½zlib.dllã以åç¸å ³å¤´æ件ãå°dllæ件å头æ件å å ¥å·¥ç¨ã
2 å缩ï¼
è°ç¨å½æ°compress.
å½¢å¼ä¸º
int compressï¼Byte * dest, uLong* destLen, const Byte *source, ULONG sourceLenï¼;
åè½æ¯å°sourceæåç空é´ï¼é¿åº¦ä¸ºsourceLençæ°æ®è¿è¡å缩ï¼å缩æ°æ®å¨åå¨destä¸ï¼é¿åº¦ç±åæ°destLenè¿åã
å¦æå缩åºéï¼è¿å对åºé误å·ï¼å¦åè¿å0.
3解å缩:
è°ç¨å½æ°uncompress.
å½¢å¼ä¸º
int uncompressï¼Byte * dest, uLong* destLen, const Byte *source, ULONG sourceLenï¼;
åè½æ¯å°sourceæåç空é´ï¼é¿åº¦ä¸ºsourceLençæ°æ®è¿è¡è§£å缩ï¼è§£å缩åçæ°æ®å¨åå¨destä¸ï¼é¿åº¦ç±åæ°destLenè¿åã
å¦æ解å缩åºéï¼è¿å对åºé误å·ï¼å¦åè¿å0.
请问有没有LZW压缩算法的源代码?
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define PATHSIZE
#define BITS
#define HashShift BITS-8
#define MAX_VALUE ((1<<BITS)-1)
#define MAX_CODE (MAX_VALUE-1)
#define HashTableLen
#define process
/*压缩结构*/
typedef struct
{
int *code;
unsigned int *prenum;
unsigned char *baknum;
}LZW_DATA;
unsigned char decode_stack[HashTableLen];
LZW_DATA lzwt,*lzw;
void dataout(FILE *output,unsigned int code);/*输出压缩后的流*/
unsigned int hashfind(unsigned int hash_prenum,unsigned int hash_character);/*压缩算法*/
char *decode(unsigned char *buffer,unsigned int code);
unsigned int incode(FILE *input);
void compress(FILE *input,FILE *output);
void decompress(FILE *input,FILE *output);
int main()
{
FILE *fp1,*fp2;
char path[PATHSIZE];
S1:puts("Input function.(h:hoop,u:uncompress)...");
fflush(stdin);
gets(path);
if(!strcmp(path,"h")||!strcmp(path,"hoop"))
{
printf("Input source file path:");
fflush(stdin);
gets(path);
if((fp1=fopen(path,"rb"))==NULL)
{
puts("Can not open source file!");
return 1;
}
printf("Input objective file path:");
fflush(stdin);
gets(path);
if((fp2=fopen(path,"wb"))==NULL)
{
puts("Can not open objective file!");
return 1;
}
compress(fp1,fp2);
}
else if(!strcmp(path,"u")||!strcmp(path,"uncompress"))
{
printf("Input source file path:");
fflush(stdin);
gets(path);
if((fp1=fopen(path,"rb"))==NULL)
{
puts("Can not open source file!");
return 1;
}
printf("Input objective file path:");
fflush(stdin);
gets(path);
if((fp2=fopen(path,"wb"))==NULL)
{
puts("Can not open objective file!");
return 1;
}
decompress(fp1,fp2);
}
else
{
puts("Input error,please input again!");
goto S1;
}
fclose(fp1);
fclose(fp2);
S2:puts("If continue or not(y:yes/n:no)?");
fflush(stdin);
gets(path);
if(!strcmp(path,"y")||!strcmp(path,"yes"))
{
goto S1;
}
else if(!strcmp(path,"n")||!strcmp(path,"no"))
{
goto S3;
}
else
{
puts("Input error,please input again!");
goto S2;
}
S3:return 0;
}
void compress(FILE *input,FILE *output)
{
int i,index,len1,len2;
int curr_code;
int baknum;
int prenum;
len1=HashTableLen*sizeof(unsigned int);
len2=HashTableLen*sizeof(unsigned char);
if(!(lzwt.code=(int*)malloc(len1)))
{
puts("Internal memory distribution error!");
exit(0);
}
if(!(lzwt.prenum=(unsigned int*)malloc(len1)))
{
puts("Internal memory distribution error!");
exit(0);
}
if(!(lzwt.baknum=(unsigned char*)malloc(len2)))
{
puts("Internal memory distribution error!");
exit(0);
}
lzw=&lzwt;
curr_code=;
for(i=0;i<HashTableLen;i++)
{
lzw->code[i]=-1;
}
i=0;
puts("Hoop begin.");
prenum=getc(input);
while((baknum=getc(input))!=EOF)
{
index=hashfind(prenum,baknum);
if(lzw->code[index]!=-1)
{
prenum=lzw->code[index];
}
else
{
if(curr_code<=(MAX_CODE))
{
lzw->code[index]=curr_code++;
lzw->prenum[index]=prenum;
lzw->baknum[index]=baknum;
}
dataout(output,prenum);
prenum=baknum;
}
if(i==prenum)
{
i=0;
putchar('.');
}
else
{
i++;
}
}
dataout(output,prenum);
dataout(output,MAX_VALUE);
dataout(output,0);
free(lzw->code);
free(lzw->prenum);
free(lzw->baknum);
}
unsigned int hashfind(unsigned int prenum,unsigned int baknum)
{
int index;
int offset;
index=(baknum<<HashShift)^prenum;
if(index==0)
{
offset=1;
}
else
{
offset=HashTableLen-index;
}
while(1)
{
if(lzw->code[index]==-1)
{
return index;
}
if(lzw->prenum[index]==prenum&&lzw->baknum[index]==baknum)
{
return index;
}
index-=offset;
if(index<0)
{
index+=HashTableLen;
}
}
}
void dataout(FILE *output,unsigned int code)
{
static int outbinary=0;
static unsigned long nob=0L;
nob|=(unsigned long)code<<(-BITS-outbinary);
outbinary+=BITS;
while(outbinary>=8)
{
putc(nob>>,output);
nob<<=8;
outbinary=outbinary-8;
}
}
void decompress(FILE *input,FILE *output)
{
unsigned int curr_code;
unsigned int baknum;
unsigned int prenum;
int i,ch,len1,len2;
char *ps;
len1=HashTableLen*sizeof(unsigned int);
len2=HashTableLen*sizeof(unsigned char);
if(!(lzwt.code=(int*)malloc(len1)))
{
puts("Internal memory distribution error!");
exit(0);
}
if(!(lzwt.prenum=(unsigned int*)malloc(len1)))
{
puts("Internal memory distribution error!");
exit(0);
}
if(!(lzwt.baknum=(unsigned char*)malloc(len2)))
{
puts("Internal memory distribution error!");
exit(0);
}
lzw=&lzwt;
curr_code=;
i=0;
puts("Uncompress begin.");
ch=prenum=incode(input);
putc(prenum,output);
while((baknum=incode(input))!=MAX_VALUE)
{
if(baknum>=curr_code)
{
*decode_stack=ch;
ps=decode(decode_stack+1,prenum);
}
else
{
ps=decode(decode_stack,prenum);
}
ch=*ps;
while(ps>=decode_stack)
{
putc(*(ps--),output);
}
if(curr_code<=MAX_CODE)
{
lzw->prenum[curr_code]=prenum;
lzw->baknum[curr_code]=ch;
curr_code++;
}
prenum=baknum;
if(i==process)
{
i=0;
putchar('.');
}
else
{
i++;
}
}
free(lzw->code);
free(lzw->prenum);
free(lzw->baknum);
}
char *decode(unsigned char *buffer,unsigned int code)
{
int len=0;
while(code>)
{
*buffer++=lzw->baknum[code];
code=lzw->prenum[code];
len++;
if(len>=HashTableLen)
{
puts("Internal memory run over!");
exit(1);
}
}
*buffer=code;
return buffer;
}
unsigned int incode(FILE *input)
{
unsigned int ret;
static int inputbinary=0;
static unsigned long nib=0L;
while(inputbinary<=)
{
nib|=(unsigned long)getc(input)<<(-inputbinary);
inputbinary=inputbinary+8;
}
ret=nib>>(-BITS);
nib<<=BITS;
inputbinary=inputbinary-BITS;
return ret;
}
这是我以前写的LZW算法,压缩和解压缩文本文件都没问题,就是解压后可能字符的顺序有点问题,呵呵用作学习的
我在这个地址回答过了,这样的复杂算法一般不会有个人去写的,我写了就觉得晕,如果提问的是同一个人,加我QQ我抽空教你原理。
/question/.html?fr=im