zoukankan      html  css  js  c++  java
  • 获取文件hash值

     public string getFilesMD5Hash(string file)
            {
                //MD5 hash provider for computing the hash of the file
                MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

                //open the file
                FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 8192);

                //calculate the files hash
                md5.ComputeHash(stream);

                //close our stream
                stream.Close();

                //byte array of files hash
                byte[] hash = md5.Hash;

                //string builder to hold the results
                StringBuilder sb = new StringBuilder();

                //loop through each byte in the byte array
                foreach (byte b in hash)
                {
                    //format each byte into the proper value and append
                    //current value to return value
                    sb.Append(string.Format("{0:X2}", b));
                }

                //return the MD5 hash of the file
                return sb.ToString();
            }

  • 相关阅读:
    marshaller unmarshaller解析xml和读取xml
    request请求地址
    SAP系统接口方式:
    SAP 后台job
    查找系统锁对象
    动态生成ABAP程序-资料
    BDC程序步骤
    ABAP 创建测试文件
    ALE和IDocs
    ABAP锁,数据库锁
  • 原文地址:https://www.cnblogs.com/CielWater/p/3757245.html
Copyright © 2011-2022 走看看