原文 C# 计算字符串的哈希值(MD5、SHA)

已做修改

一、关于本文

本文中是一个类库,包括下面几个函数:

/// 1)计算32位MD5码(大小写):Hash_MD5_32
/// 2)计算16位MD5码(大小写):Hash_MD5_16
/// 3)计算32位2重MD5码(大小写):Hash_2_MD5_32
/// 4)计算16位2重MD5码(大小写):Hash_2_MD5_16
/// 5)计算SHA-1码(大小写):Hash_SHA_1
/// 6)计算SHA-256码(大小写):Hash_SHA_256
/// 7)计算SHA-384码(大小写):Hash_SHA_384
/// 8)计算SHA-512码(大小写):Hash_SHA_512
/// 9)计算文件的 SHA256 值:SHA256File
/// 10)计算文件的 MD5 值:MD5File
/// 11)计算文件的 SHA1 值:SHA1File

编译后被打包成文件HashTools.dll,其他程序可以在添加引用后对这些函数进行调用

二、类库中各函数代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace HashTool
{
/// <summary>
/// C# 计算字符串/文件哈希值(MD5、SHA)
/// 1)计算32位MD5码(大小写):Hash_MD5_32
/// 2)计算16位MD5码(大小写):Hash_MD5_16
/// 3)计算32位2重MD5码(大小写):Hash_2_MD5_32
/// 4)计算16位2重MD5码(大小写):Hash_2_MD5_16
/// 5)计算SHA-1码(大小写):Hash_SHA_1
/// 6)计算SHA-256码(大小写):Hash_SHA_256
/// 7)计算SHA-384码(大小写):Hash_SHA_384
/// 8)计算SHA-512码(大小写):Hash_SHA_512
/// 9)计算文件的 SHA256 值:SHA256File
/// 10)计算文件的 MD5 值:MD5File
/// 11)计算文件的 SHA1 值:SHA1File
/// </summary>
public class HashHelper
{ /// <summary>
/// 计算32位MD5码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_MD5_32(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.MD5CryptoServiceProvider MD5CSP
= new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = MD5CSP.ComputeHash(bytValue);
MD5CSP.Clear(); //根据计算得到的Hash码翻译为MD5码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 计算16位MD5码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_MD5_16(string word, bool toUpper = true)
{
try
{
string sHash = Hash_MD5_32(word).Substring(, );
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
} /// <summary>
/// 计算32位2重MD5码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_2_MD5_32(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.MD5CryptoServiceProvider MD5CSP
= new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = MD5CSP.ComputeHash(bytValue); //根据计算得到的Hash码翻译为MD5码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} bytValue = System.Text.Encoding.UTF8.GetBytes(sHash);
bytHash = MD5CSP.ComputeHash(bytValue);
MD5CSP.Clear();
sHash = ""; //根据计算得到的Hash码翻译为MD5码
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
} /// <summary>
/// 计算16位2重MD5码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_2_MD5_16(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.MD5CryptoServiceProvider MD5CSP
= new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = MD5CSP.ComputeHash(bytValue); //根据计算得到的Hash码翻译为MD5码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} sHash = sHash.Substring(, ); bytValue = System.Text.Encoding.UTF8.GetBytes(sHash);
bytHash = MD5CSP.ComputeHash(bytValue);
MD5CSP.Clear();
sHash = ""; //根据计算得到的Hash码翻译为MD5码
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} sHash = sHash.Substring(, ); //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 计算SHA-1码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_SHA_1(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.SHA1CryptoServiceProvider SHA1CSP
= new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = SHA1CSP.ComputeHash(bytValue);
SHA1CSP.Clear(); //根据计算得到的Hash码翻译为SHA-1码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 计算SHA-256码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_SHA_256(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.SHA256CryptoServiceProvider SHA256CSP
= new System.Security.Cryptography.SHA256CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = SHA256CSP.ComputeHash(bytValue);
SHA256CSP.Clear(); //根据计算得到的Hash码翻译为SHA-1码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 计算SHA-384码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_SHA_384(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.SHA384CryptoServiceProvider SHA384CSP
= new System.Security.Cryptography.SHA384CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = SHA384CSP.ComputeHash(bytValue);
SHA384CSP.Clear(); //根据计算得到的Hash码翻译为SHA-1码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 计算SHA-512码
/// </summary>
/// <param name="word">字符串</param>
/// <param name="toUpper">返回哈希值格式 true:英文大写,false:英文小写</param>
/// <returns></returns>
public static string Hash_SHA_512(string word, bool toUpper = true)
{
try
{
System.Security.Cryptography.SHA512CryptoServiceProvider SHA512CSP
= new System.Security.Cryptography.SHA512CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(word);
byte[] bytHash = SHA512CSP.ComputeHash(bytValue);
SHA512CSP.Clear(); //根据计算得到的Hash码翻译为SHA-1码
string sHash = "", sTemp = "";
for (int counter = ; counter < bytHash.Count(); counter++)
{
long i = bytHash[counter] / ;
if (i > )
{
sTemp = ((char)(i - + 0x41)).ToString();
}
else
{
sTemp = ((char)(i + 0x30)).ToString();
}
i = bytHash[counter] % ;
if (i > )
{
sTemp += ((char)(i - + 0x41)).ToString();
}
else
{
sTemp += ((char)(i + 0x30)).ToString();
}
sHash += sTemp;
} //根据大小写规则决定返回的字符串
return toUpper ? sHash : sHash.ToLower();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
} /// <summary>
/// 计算文件的 SHA256 值
/// </summary>
/// <param name="fileStream">文件流</param>
/// <returns>System.String.</returns>
public static string SHA256File(System.IO.FileStream fileStream)
{
System.Security.Cryptography.SHA256 mySHA256 = System.Security.Cryptography.SHA256Managed.Create(); byte[] hashValue; // Create a fileStream for the file.
//FileStream fileStream = fInfo.Open(FileMode.Open);
// Be sure it's positioned to the beginning of the stream.
fileStream.Position = ;
// Compute the hash of the fileStream.
hashValue = mySHA256.ComputeHash(fileStream); // Close the file.
fileStream.Close();
// Write the hash value to the Console.
return PrintByteArray(hashValue); }
/// <summary>
/// 计算文件的 MD5 值
/// </summary>
/// <param name="fileName">要计算 MD5 值的文件名和路径</param>
/// <returns>MD5 值16进制字符串</returns>
public static string MD5File(string fileName)
{ return HashFile(fileName, "md5"); } /// <summary>
/// 计算文件的 sha1 值
/// </summary>
/// <param name="fileName">要计算 sha1 值的文件名和路径</param>
/// <returns>sha1 值16进制字符串</returns>
public static string SHA1File(string fileName)
{ return HashFile(fileName, "sha1"); } /// <summary>
/// 计算文件的哈希值
/// </summary>
/// <param name="fileName">要计算哈希值的文件名和路径</param>
/// <param name="algName">算法:sha1,md5</param>
/// <returns>哈希值16进制字符串</returns>
private static string HashFile(string fileName, string algName)
{ if (!System.IO.File.Exists(fileName)) return string.Empty; System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] hashBytes = HashData(fs, algName); fs.Close(); return ByteArrayToHexString(hashBytes); } /// <summary>
/// 计算哈希值
/// </summary>
/// <param name="stream">要计算哈希值的 Stream</param>
/// <param name="algName">算法:sha1,md5</param>
/// <returns>哈希值字节数组</returns>
private static byte[] HashData(System.IO.Stream stream, string algName)
{ System.Security.Cryptography.HashAlgorithm algorithm; if (algName == null)
{ throw new ArgumentNullException("algName 不能为 null"); } if (string.Compare(algName, "sha1", true) == )
{ algorithm = System.Security.Cryptography.SHA1.Create(); } else
{ if (string.Compare(algName, "md5", true) != )
{ throw new Exception("algName 只能使用 sha1 或 md5"); } algorithm = System.Security.Cryptography.MD5.Create(); } return algorithm.ComputeHash(stream); } /// <summary>
/// 字节数组转换为16进制表示的字符串
/// </summary>
private static string ByteArrayToHexString(byte[] buf)
{ return BitConverter.ToString(buf).Replace("-", ""); } private static string PrintByteArray(byte[] array)
{
StringBuilder sb = new StringBuilder();
int i;
for (i = ; i < array.Length; i++)
{
sb.Append(String.Format("{0:X2}", array[i])); }
return sb.ToString();
} /// <summary>
/// 计算指定文件的CRC32值
/// </summary>
/// <param name="fileName">指定文件的完全限定名称</param>
/// <returns>返回值的字符串形式</returns>
public static String Crc32File(String fileName)
{
String hashCRC32 = String.Empty;
//检查文件是否存在,如果文件存在则进行计算,否则返回空值
if (System.IO.File.Exists(fileName))
{
using (System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
//计算文件的CSC32值
Crc32 calculator = new Crc32();
Byte[] buffer = calculator.ComputeHash(fs);
calculator.Clear();
//将字节数组转换成十六进制的字符串形式
StringBuilder stringBuilder = new StringBuilder();
for (int i = ; i < buffer.Length; i++)
{
stringBuilder.Append(buffer[i].ToString("X2"));
}
hashCRC32 = stringBuilder.ToString();
}//关闭文件流
}
return hashCRC32;
} #region Class CRC32 算法的实现
/// <summary>
/// 提供 CRC32 算法的实现
/// </summary>
private class Crc32 : System.Security.Cryptography.HashAlgorithm
{
public const UInt32 DefaultPolynomial = 0xedb88320;
public const UInt32 DefaultSeed = 0xffffffff;
private UInt32 hash;
private UInt32 seed;
private UInt32[] table;
private static UInt32[] defaultTable;
public Crc32()
{
table = InitializeTable(DefaultPolynomial);
seed = DefaultSeed;
Initialize();
}
public Crc32(UInt32 polynomial, UInt32 seed)
{
table = InitializeTable(polynomial);
this.seed = seed;
Initialize();
}
public override void Initialize()
{
hash = seed;
}
protected override void HashCore(byte[] buffer, int start, int length)
{
hash = CalculateHash(table, hash, buffer, start, length);
}
protected override byte[] HashFinal()
{
byte[] hashBuffer = UInt32ToBigEndianBytes(~hash);
this.HashValue = hashBuffer;
return hashBuffer;
}
public static UInt32 Compute(byte[] buffer)
{
return ~CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, , buffer.Length);
}
public static UInt32 Compute(UInt32 seed, byte[] buffer)
{
return ~CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, , buffer.Length);
}
public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer)
{
return ~CalculateHash(InitializeTable(polynomial), seed, buffer, , buffer.Length);
}
private static UInt32[] InitializeTable(UInt32 polynomial)
{
if (polynomial == DefaultPolynomial && defaultTable != null)
{
return defaultTable;
}
UInt32[] createTable = new UInt32[];
for (int i = ; i < ; i++)
{
UInt32 entry = (UInt32)i;
for (int j = ; j < ; j++)
{
if ((entry & ) == )
entry = (entry >> ) ^ polynomial;
else
entry = entry >> ;
}
createTable[i] = entry;
}
if (polynomial == DefaultPolynomial)
{
defaultTable = createTable;
}
return createTable;
}
private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, byte[] buffer, int start, int size)
{
UInt32 crc = seed;
for (int i = start; i < size; i++)
{
unchecked
{
crc = (crc >> ) ^ table[buffer[i] ^ crc & 0xff];
}
}
return crc;
}
private byte[] UInt32ToBigEndianBytes(UInt32 x)
{
return new byte[] { (byte)((x >> ) & 0xff), (byte)((x >> ) & 0xff), (byte)((x >> ) & 0xff), (byte)(x & 0xff) };
}
} #endregion } }
 
三、函数调用
建立项目ComputeHash,添加对HashTools.dll库的引用。并添加代码:  
using HashTools;
然后在Main函数中添加下列代码:
static void Main(string[] args)
{
Console.WriteLine("MD5 of \"abc\""); Console.WriteLine("MD5_32(Upper): {0}",
HashHelper.Hash_MD5_32("abc"));
Console.WriteLine("MD5_32(Lower): {0}",
HashHelper.Hash_MD5_32("abc", false)); Console.WriteLine("MD5_16(Upper): {0}",
HashHelper.Hash_MD5_16("abc"));
Console.WriteLine("MD5_16(Lower): {0}",
HashHelper.Hash_MD5_16("abc", false)); Console.WriteLine("2_MD5_32(Upper): {0}",
HashHelper.Hash_2_MD5_32("abc"));
Console.WriteLine("2_MD5_32(Lower): {0}",
HashHelper.Hash_2_MD5_32("abc", false)); Console.WriteLine("2_MD5_32(Upper): {0}",
HashHelper.Hash_2_MD5_16("abc"));
Console.WriteLine("2_MD5_32(Lower): {0}",
HashHelper.Hash_2_MD5_16("abc", false)); Console.WriteLine("SHA of \"abc\""); Console.WriteLine("SHA-1(Upper): {0}",
HashHelper.Hash_SHA_1("abc"));
Console.WriteLine("SHA-1(Lower): {0}",
HashHelper.Hash_SHA_1("abc", false)); Console.WriteLine("SHA-256(Upper): {0}",
HashHelper.Hash_SHA_256("abc"));
Console.WriteLine("SHA-256(Lower): {0}",
HashHelper.Hash_SHA_256("abc", false)); Console.WriteLine("SHA-384(Upper): {0}",
HashHelper.Hash_SHA_384("abc"));
Console.WriteLine("SHA-384(Lower): {0}",
HashHelper.Hash_SHA_384("abc", false)); Console.WriteLine("SHA-512(Upper): {0}",
HashHelper.Hash_SHA_512("abc"));
Console.WriteLine("SHA-512(Lower): {0}",
HashHelper.Hash_SHA_512("abc", false)); Console.ReadLine();
}
运行结果如下:

 
END

C# 计算字符串/文件的哈希值(MD5、SHA)的更多相关文章

  1. usb转串口驱动时会出现“文件的哈希值不在指定的目录”这样的提示

    一般在安装一些usb转串口驱动时会出现“文件的哈希值不在指定的目录”这样的提示,那么怎么解决呢?知道的别喷我哦,我只是再普及一下,嘿嘿1.鼠标移到右下角,点击“设置”,再点击“更改电脑设置”2.点击最 ...

  2. WIN10下安装USB转串口驱动出现“文件的哈希值不在指定的目录”的解决办法

    今天安装openJTAG驱动时出现“文件的哈希值不在指定的目录”,系统为WIN10专业版. 原因是驱动无数字签名,在WIN10中是不安全的驱动,所以显示哈希值不在范围内不能安装. 经查阅已经解决,发放 ...

  3. USB-Blaster CPLD FPGA Intel 驱动安装不上的问题,文件的哈希值不在指定的目录文件中,的解决办法,其实很简单

    intel的官网的驱动安装文档: https://www.intel.com/content/www/us/en/programmable/support/support-resources/down ...

  4. 文件的哈希值不在指定的目录文件中。此文件可能已损坏或被篡(Windows10 /Windows8.1)

    ------------------------------------------Windows10------------------------------------------------ ...

  5. win8.1安装驱动出现“文件的哈希值不在指定的目录”的解决办法[zz]

    1.鼠标移到右下角,点击“设置”,再点击“更改电脑设置”2.点击最后一个“更新和回复”,再点击“恢复”3.点击“恢复”之后,在右边点击高级启动下面的“重新启动”4.等一会会出现几个选项,点击“疑难解答 ...

  6. Java中String的哈希值计算

    下面都是从String类的源码中粘贴出来的 private int hash; // Default to 0 public int hashCode() { int h = hash; if (h ...

  7. USB-Blaster驱动安装失败——文件哈希值不在指定目录中

    右击此电脑,选择管理,选择设备管理器,更新USB-Blaster驱动出现问题 问题: 文件的哈希值不在指定的目录文件中,如图: 解决办法: Windows键+R→shutdown.exe /r /o ...

  8. 加解密(校验哈希值、MD5值)

    1.计算文本哈希值: public static string ComputeHash(string password) { byte[] buffer = System.Text.Encoding. ...

  9. poj1200 字符串hash 滚动哈希初探

    假如要判断字符串A“AABA”是否是字符串B“AABAACAADAABAABA”的子串 最朴素的算法是枚举B的所有长度为4的子串,然后逐个与A进行对比,这样的时间复杂度是O(mn),m为A的长度,n为 ...

随机推荐

  1. adb logcat 命令行用法

    作者 :万境绝尘  转载请著名出处 eclipse 自带的 LogCat 工具太垃圾了, 开始用 adb logcat 在终端查看日志; 1. 解析 adb logcat 的帮助信息 在命令行中输入  ...

  2. EEPlat PaaS VS Saleforce force.com

    综述 EEPlatPaaS和Saleforce的Force.com都是元数据驱动应用的解决方式.整体而言,Force.com提供了更上层的解决方式,屏蔽了SQL语句.数据库:EEPlat更加底层,有更 ...

  3. OnClick事件的Sender参数的前世今生——TWinControl.WinProc优先捕捉到鼠标消息,然后使用IsControlMouseMsg函数进行消息转发给图形子控件(意外发现OnClick是由WM_LBUTTONUP触发的)

    这是一个再普通不过的Button1Click执行体: procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage('I am B ...

  4. BCM wifi驱动学习

    BCMwifi驱动学习 一.wifi详解1 1.代码路径:Z:\home\stonechen\svn\TD550_X\TD550\3rdparty\wifi\BCM43362\special\bcmd ...

  5. 电驴 emule 源代码分析 (1)

    关于电驴emule 的源代码,网上有一个  叫刘刚的人 分析的 非常多,可是假设你仅仅是看别人的分析,自己没有亲身去阅读代码的话,恐怕非常难  剖析整个系统. 关于emule  主要就是 连接 kad ...

  6. Tomcat详细用法学习(三)

    本篇接上一篇<Tomcat详细用法学习(二)>,主要讲解服务器所要求的web应用的组织结构. 上一篇说到了如何使用服务器将自己的web应用映射成虚拟目录,以便于在浏览器中可以对自己开发的w ...

  7. iot 表 主键索引叶子块包含了表所有数据

    <pre name="code" class="html">iot表测试: 在create table语句后面使用organization inde ...

  8. boost asio 异步实现tcp通讯

    ---恢复内容开始--- asioboost   目录(?)[-] 一前言 二实现思路 通讯包数据结构 连接对象 连接管理器 服务器端的实现 对象串行化   一.前言 boost asio可算是一个简 ...

  9. SilkTest Q&A 7

    Q61.有一个用Dotnet开发的应用,有1000个为测它而录制的case,一直都运行的很正常,直到有一天… 有人改变了该应用命名空间,由于现在有一个新的window或是panel出现,所以测试脚本一 ...

  10. 积累的VC编程小技巧之属性页

    1.属性页的添加: 创建对话框的类,该类要从CpropertyPage继承:然后在要添加该对话框为属性页的类(头文件)里创建CpropertySheet类的一个对象m_tabsheet和新创建的对话框 ...