资源简介

使用mac地址对电脑授权,输入mac地址,选择时间,使用des加密,生成文件 密钥见源文件中

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;

namespace FMSLicenseMachine
{
    
    /// 
  public class DES 
  { 
  
    /// 
    /// 
    ///  
    ///   
    public static string Encode(string str string key)
        {
            try
            {
                DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
                provider.Key = Encoding.ASCII.GetBytes(key.Substring(0 8));
                provider.IV = Encoding.ASCII.GetBytes(key.Substring(0 8));
                byte[] bytes = Encoding.GetEncoding(“utf-8“).GetBytes(str);
                MemoryStream stream = new MemoryStream();
                CryptoStream stream2 = new CryptoStream(stream provider.CreateEncryptor() CryptoStreamMode.Write);
                stream2.Write(bytes 0 bytes.Length);
                stream2.FlushFinalBlock();
                StringBuilder builder = new StringBuilder();
                foreach (byte num in stream.ToArray())
                {
                    builder.AppendFormat(“{0:X2}“ num);
                }
                stream.Close();
                return builder.ToString();
            }
            catch (Exception) { return “xxxx“; }
        }
    /// 
    /// 
    ///  
    ///   
    public static string Decode(string str string key) 
    { 
      try
      { 
        DESCryptoServiceProvider provider = new DESCryptoServiceProvider(); 
        provider.Key = Encoding.ASCII.GetBytes(key.Substring(0 8)); 
        provider.IV = Encoding.ASCII.GetBytes(key.Substring(0 8)); 
        byte[] buffer = new byte[str.Length / 2]; 
        for (int i = 0; i < (str.Length / 2); i++) 
        { 
          int num2 = Convert.ToInt32(str.Substring(i * 2 2) 0x10); 
          buffer[i] = (byte)num2; 
        } 
        MemoryStream stream = new MemoryStream(); 
        CryptoStream stream2 = new CryptoStream(stream provider.CreateDecryptor() CryptoStreamMode.Write); 
        stream2.Write(buffer 0 buffer.Length); 
        stream2.FlushFinalBlock(); 
        stream.Close(); 
        return Encoding.GetEncoding(“UTF-8“).GetString(stream.ToArray()); 
      } 
      catch (Exception) { return ““; } 
    }

    public static void main(string[] asd)
    {

    }
  }  
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    I.A....       941  2018-03-01 13:25  FMSLicenseMachine.sln

    I.A....     18944  2018-03-01 13:25  FMSLicenseMachine.suo

    I.A....     15872  2018-03-01 13:25  FMSLicenseMachine\bin\Debug\FMSLicenseMachine.exe

    I.A....     34304  2018-03-01 13:25  FMSLicenseMachine\bin\Debug\FMSLicenseMachine.pdb

    I.A....     14328  2018-03-01 13:25  FMSLicenseMachine\bin\Debug\FMSLicenseMachine.vshost.exe

    I.A....     83456  2018-03-01 13:25  FMSLicenseMachine\bin\Release\FMSLicenseMachine.exe

    I.A....     32256  2018-03-01 13:25  FMSLicenseMachine\bin\Release\FMSLicenseMachine.pdb

    I.A....     14328  2018-03-01 13:25  FMSLicenseMachine\bin\Release\FMSLicenseMachine.vshost.exe

    I.A....       490  2018-03-01 13:25  FMSLicenseMachine\bin\Release\FMSLicenseMachine.vshost.exe.manifest

    I.A....      2864  2018-03-01 13:25  FMSLicenseMachine\DES.cs

    I.A....     67646  2018-03-01 13:25  FMSLicenseMachine\fms.ico

    I.A....      3967  2018-03-01 13:25  FMSLicenseMachine\FMSLicenseMachine.csproj

    I.A....      6301  2018-03-01 13:25  FMSLicenseMachine\Form1.cs

    I.A....      9977  2018-03-01 13:25  FMSLicenseMachine\Form1.Designer.cs

    I.A....      5814  2018-03-01 13:25  FMSLicenseMachine\Form1.resx

    I.A....       746  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.csproj.FileListAbsolute.txt

    I.A....       847  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.csproj.GenerateResource.Cache

    I.A....     15872  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.exe

    I.A....       180  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.Form1.resources

    I.A....     34304  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.pdb

    I.A....       180  2018-03-01 13:25  FMSLicenseMachine\obj\Debug\FMSLicenseMachine.Properties.Resources.resources

    I.A....       762  2018-03-01 13:25  FMSLicenseMachine\obj\Release\FMSLicenseMachine.csproj.FileListAbsolute.txt

    I.A....       847  2018-03-01 13:25  FMSLicenseMachine\obj\Release\FMSLicenseMachine.csproj.GenerateResource.Cache

    I.A....       180  2018-03-01 13:25  FMSLicenseMachine\obj\Release\FMSLicenseMachine.Form1.resources

    I.A....     32256  2018-03-01 13:25  FMSLicenseMachine\obj\Release\FMSLicenseMachine.pdb

    I.A....       180  2018-03-01 13:25  FMSLicenseMachine\obj\Release\FMSLicenseMachine.Properties.Resources.resources

    I.A....     83456  2018-03-01 13:25  FMSLicenseMachine\obj\Release\LicenseMachine.exe

    I.A....       498  2018-03-01 13:25  FMSLicenseMachine\Program.cs

    I.A....      1384  2018-03-01 13:25  FMSLicenseMachine\Properties\AssemblyInfo.cs

    I.A....      2884  2018-03-01 13:25  FMSLicenseMachine\Properties\Resources.Designer.cs

............此处省略18个文件信息

评论

共有 条评论