using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public string StringToHex(string str)
{
int i;
byte[] ByteFoo = System.Text.Encoding.Default.GetBytes(str);//将输入的字符转成16进制
string TempStr = "";
byte[] aa = new byte[ByteFoo.Length/2];
byte[] bb = new byte[ByteFoo.Length/2];
byte[] cc = new byte[ByteFoo.Length/2];
byte[] dd = new byte[ByteFoo.Length/2];
for (i=0;i<ByteFoo.Length/2;i++)
{
aa[i] = (byte)(ByteFoo[2 * i] << 4);//将奇数字节