mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 09:24:58 +00:00
Add EncryptStringHIGHT(), DecryptStringHIGHT()
This commit is contained in:
parent
541078bda8
commit
f4b86735fb
|
@ -4,7 +4,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace WelsonJS
|
||||
{
|
||||
public class ProcessTool
|
||||
public class ProcessUtils
|
||||
{
|
||||
public static List<int> ProcessIDs = new List<int>();
|
||||
|
|
@ -30,7 +30,9 @@
|
|||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using WelsonJS.Cryptography;
|
||||
|
||||
namespace WelsonJS
|
||||
{
|
||||
|
@ -193,25 +195,25 @@ namespace WelsonJS
|
|||
[ComVisible(true)]
|
||||
public string GetFilePathFromDialog()
|
||||
{
|
||||
return ProcessTool.OpenFileDialog();
|
||||
return ProcessUtils.OpenFileDialog();
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public int OpenProcess(string filepath)
|
||||
{
|
||||
return ProcessTool.Open(filepath);
|
||||
return ProcessUtils.Open(filepath);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool CloseProcess(int processID)
|
||||
{
|
||||
return ProcessTool.Close(processID);
|
||||
return ProcessUtils.Close(processID);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public void CompressLZ77(string data)
|
||||
public string CompressLZ77(string data)
|
||||
{
|
||||
Compression.LZ77.Compress(data);
|
||||
return Compression.LZ77.Compress(data);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
|
@ -219,5 +221,25 @@ namespace WelsonJS
|
|||
{
|
||||
return Compression.LZ77.Decompress(compressedData);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public string EncryptStringHIGHT(string key, string data)
|
||||
{
|
||||
byte[] userKey = Encoding.ASCII.GetBytes(key);
|
||||
byte[] dataIn = Encoding.UTF8.GetBytes(data);
|
||||
|
||||
HIGHT.ECB cipher = new HIGHT.ECB(userKey);
|
||||
return Convert.ToBase64String(cipher.Encrypt(dataIn));
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public string DecryptStringHIGHT(string key, string encryptedData)
|
||||
{
|
||||
byte[] userKey = Encoding.ASCII.GetBytes(key);
|
||||
byte[] dataIn = Convert.FromBase64String(encryptedData);
|
||||
|
||||
HIGHT.ECB cipher = new HIGHT.ECB(userKey);
|
||||
return Encoding.UTF8.GetString(cipher.Decrypt(dataIn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<Compile Include="Compression\LZ77.cs" />
|
||||
<Compile Include="Cryptography\HIGHT.cs" />
|
||||
<Compile Include="NamedSharedMemory.cs" />
|
||||
<Compile Include="ProcessTool.cs" />
|
||||
<Compile Include="ProcessUtils.cs" />
|
||||
<Compile Include="Prompt.cs" />
|
||||
<Compile Include="Toolkit.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user