public static void func(Stream oldstream, Stream newstream, byte[] pwd)
{
const int c = 1024;
byte[] b = new byte[c];
int i = 0, j = 0;
long l = 0;
while ((i = oldstream.Read(b, 0, c)) > 0)
{
for (int k = 0; k < i; k++) b[k] = Convert.ToByte(b[k] ^ pwd[j >= pwd.Length ? 0 : j++]);
newstream.Write(b, 0, i);
newstream.Flush();
}
}
int func(char *in_fname,char *pwd,char *out_fname)
{
FILE *fp1,*fp2;
register char ch;
int j=0;
int j0=0;
fp1=fopen(in_fname,"rb");
if(fp1==NULL)
{
return 0;
}
fp2=fopen(out_fname,"wb");
if(fp2==NULL)
{
fclose(fp1);
return 0;
}
while(pwd[++j0]);
ch=fgetc(fp1);
while(!feof(fp1))
{
fputc(ch^pwd[j>=j0?j=0:j++],fp2);
ch=fgetc(fp1);
}
fclose(fp1);fclose(fp2);
return 1;
}


