using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace WindowsApplication1
{
public
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//查询输入的域名
string net = this.textBox_net.Text.ToString();
if (net.Trim() == string.Empty || net == "")
{
this.textBox_IP.Text = "请输入域名";
return;
}
try
{
System.Net.IPHostEntry host =
System.Net.Dns.GetHostEntry(net);
this.textBox_IP.Text =
host.AddressList.GetValue(0).ToString();
}
catch (Exception ex)
{
this.textBox_IP.Text = "查询有误";
return;
}
}
private void button3_Click(object sender, EventArgs e)
{
//MD5
string word = this.textBox_word.Text.ToString();
if (word.Trim() == string.Empty || word.Trim() == "")
{
this.textBox_mi.Text = "请输入需要加密的字符";
return;
}
try
{
MD5CryptoServiceProvider md5 = new
MD5CryptoServiceProvider();
byte[] encryptedBytes =
md5.ComputeHash(Encoding.ASCII.GetBytes(word));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < encryptedBytes.Length;
i++)
{
sb.AppendFormat("{0:x2}", encryptedBytes[i]);
}