• 大小: 88KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: C#
  • 标签: C#  Hex  Bin  

资源简介

这是一个2013版visual studio 编写的hex文件转bin文件的工程,调试通过,而且文件转换需要输入密码才能转换,源码奉上,需要的可以将密码部分去掉

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Hex2Bin
{
    class AESDLL
    {
        /// 
        /// AES加密初始化
        /// 

        [DllImport(“AES256.dll“)]
        public static extern void aesEncInit();
        /// 
        /// AES加密
        /// 

        /// 
        /// 
        [DllImport(“AES256.dll“)]
        public static extern void aesEncrypt(ref byte bufferref byte chainBlock );
        /// 
        /// AES解密初始化
        /// 

        [DllImport(“AES256.dll“)]
        public static extern void aesDecInit();
        /// 
        /// AES解密
        /// 

        /// 
        /// 
        [DllImport(“AES256.dll“)]
        public static extern void aesDecrypt(ref byte buffer ref byte chainBlock);
        /// 
        /// 设置解密Key
        /// 

        /// 
        [DllImport(“AES256.dll“)]
        public static extern void SetKey(ref byte KeyBuffer);

        public static string ToHexString(byte[] bytes)
        {
            string hexString = string.Empty;
            if (bytes != null)
            {
                StringBuilder strB = new StringBuilder();

                for (int i = 0; i < bytes.Length; i++)
                {
                    strB.Append(bytes[i].ToString(“X2“) + “ “);
                }
                hexString = strB.ToString();
            }
            return hexString;
        }

        /// 
        /// 将String包内容传进去然后返回Byte[]
        /// 

        /// 需要发包的明文字符串
        /// 
        public static byte[] StringToByteArray(string str)
        {
            List bytelist = new List();
            str = str.Replace(“ “ ““);//去空格
            int length = str.Length / 2;//包长度
            try
            {
                for (int i = 0; i < length; i++)
                {
                    bytelist.Add(Convert.ToByte(str.Substring(2 * i 2) 16));
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                return (null);
            }
            return bytelist.ToArray();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-28 18:02  Hextobin\
     目录           0  2018-04-28 18:02  Hextobin\Hex2Bin\
     目录           0  2011-09-20 15:02  Hextobin\Hex2Bin\Hex2Bin\
     文件         907  2011-09-18 16:30  Hextobin\Hex2Bin\Hex2Bin.sln
     文件       17408  2011-09-23 09:45  Hextobin\Hex2Bin\Hex2Bin.suo
     文件       38400  2018-11-04 15:10  Hextobin\Hex2Bin\Hex2Bin.v12.suo
     文件        2647  2011-09-23 09:04  Hextobin\Hex2Bin\Hex2Bin\AESDLL.cs
     文件          69  2011-09-16 09:39  Hextobin\Hex2Bin\Hex2Bin\app.config
     目录           0  2011-09-19 21:50  Hextobin\Hex2Bin\Hex2Bin\bin\
     目录           0  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\
     文件       32768  2011-09-23 08:58  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\AES256.dll
     文件       13824  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.exe
     文件          69  2011-09-16 09:39  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.exe.config
     文件       28160  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.pdb
     文件       22704  2018-11-04 15:10  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.vshost.exe
     文件          69  2011-09-16 09:39  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.vshost.exe.config
     文件         490  2010-03-17 22:39  Hextobin\Hex2Bin\Hex2Bin\bin\Debug\Hex2Bin.vshost.exe.manifest
     目录           0  2011-09-19 21:50  Hextobin\Hex2Bin\Hex2Bin\bin\Release\
     文件       32768  2011-09-18 11:58  Hextobin\Hex2Bin\Hex2Bin\DLLTest.dll
     文件        8386  2011-09-23 09:16  Hextobin\Hex2Bin\Hex2Bin\frMain.cs
     文件        9352  2011-09-23 09:08  Hextobin\Hex2Bin\Hex2Bin\frMain.Designer.cs
     文件        6384  2011-09-23 09:08  Hextobin\Hex2Bin\Hex2Bin\frMain.resx
     文件        5103  2011-09-18 16:30  Hextobin\Hex2Bin\Hex2Bin\Hex2Bin.csproj
     文件         433  2011-09-16 13:47  Hextobin\Hex2Bin\Hex2Bin\Hex2Bin.csproj.user
     目录           0  2011-09-19 21:50  Hextobin\Hex2Bin\Hex2Bin\obj\
     目录           0  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\
     文件         791  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6198  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         916  2018-11-04 15:10  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\Hex2Bin.csproj.FileListAbsolute.txt
     文件         848  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\Hex2Bin.csproj.GenerateResource.Cache
     文件        1341  2018-04-28 18:02  Hextobin\Hex2Bin\Hex2Bin\obj\Debug\Hex2Bin.csprojResolveAssemblyReference.cache
............此处省略14个文件信息

评论

共有 条评论