String landingIdMd5 = MyZipUtil.md5Purity("ipadUser"); //md5加密
             String landingPwdMd5 = MyZipUtil.md5Purity("666666");  //md5加密
             byte[] key = Encoding.Default.GetBytes(landingIdMd5+landingPwdMd5);
            FileStream inputStream=new FileStream("D:\\PARTEST.zip",FileMode.Open);
            FileStream outputStream = new FileStream("D:\\PARTEST_TEMP.zip", FileMode.CreateNew);
            //去除文件头的69位
            inputStream.Seek(69, SeekOrigin.Begin);
            byte[] bytes = new byte[1024];
            byte[] outBytes = new byte[1024];
            int n = 0;
            int x = 0;
            while (-1!=(n=inputStream.Read(bytes,0,1024))) {
                for (int i = 0; i < n; i++) {
                   byte b = bytes[i];
                     b ^= key[x];
                     outBytes[i] = b;
                     x++;
                    if(x>63){
                         x=0;
                     }
                }
                outputStream.Write(outBytes,0,n);
            }
            inputStream.Close();
            outputStream.Close();前面的两个加密类库,你找相应的C#方法吧

解决方案 »

  1.   

    非常感谢你 还有一个问题 md5加密是这样的  哪里可以找到解决这个的方法呢
    public static String md5Purity(String plainText) {
    try {
    //初始化息摘要算法
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(plainText.getBytes());
    byte b[] = md.digest();
    int i;
    StringBuffer buf = new StringBuffer("");
    for (int offset = 0; offset < b.length; offset++) {
    i = b[offset];
    if (i < 0)
    i += 256;
    if (i < 16)
    buf.append("0");
    buf.append(Integer.toHexString(i));
    }
    plainText = buf.toString();
    } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    }
    return plainText; }
      

  2.   

    private static string md5Purity(string Source)
            {
                MD5 md5 = new MD5CryptoServiceProvider();
                byte[] result = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Source));
                return BitConverter.ToString(result).Replace("-", "").ToUpper();
            }
      

  3.   

     while (-1!=(n=inputStream.Read(bytes,0,1024))) { 这个不能用-1!= 要用 0<
             
     while ((n=inputStream.Read(bytes,0,1024))>0 ) {java取字节取尽了返回-1 
    C#是返回0
      

  4.   

    非常感谢你 还有一个问题 md5加密是这样的  哪里可以找到解决这个的方法呢
    public static String md5Purity(String plainText) {
    try {
    //初始化息摘要算法
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(plainText.getBytes());
    byte b[] = md.digest();
    int i;
    StringBuffer buf = new StringBuffer("");
    for (int offset = 0; offset < b.length; offset++) {
    i = b[offset];
    if (i < 0)
    i += 256;
    if (i < 16)
    buf.append("0");
    buf.append(Integer.toHexString(i));
    }
    plainText = buf.toString();
    } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    }
    return plainText; }

    Md5加密的自己搜索一下吧,网上可以找到C#的函数实现的