增加老版本 KJDWebService
This commit is contained in:
1 parent
58abbb5b4f
commit
f84c4c1949
115 files changed
+36598
-18
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace StoreHub.KJDWebService.Commons
|
||||
{
|
||||
public class EncrypUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// 加密算法
|
||||
/// </summary>
|
||||
/// <param name="s">加密字符串</param>
|
||||
/// <returns></returns>
|
||||
public static string Encryption(int s)
|
||||
{
|
||||
string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD";
|
||||
return GetMd5(sign);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MD5加密
|
||||
/// </summary>
|
||||
/// <param name="instring"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMd5(string instring)
|
||||
{
|
||||
byte[] result = Encoding.Default.GetBytes(instring.Trim());
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] output = md5.ComputeHash(result);
|
||||
return BitConverter.ToString(output).Replace("-", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件MD5值
|
||||
/// </summary>
|
||||
/// <param name="FilePath"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFileMd5(string FilePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileStream get_file = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider get_md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] hash_byte = get_md5.ComputeHash(get_file);
|
||||
string resule = System.BitConverter.ToString(hash_byte);
|
||||
resule = resule.Replace("-", "");
|
||||
get_file.Close();
|
||||
return resule;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user