Change the API name DecryptStringHIGHT to DecryptString and EncryptStringHIGHT to EncryptString

This commit is contained in:
Namhyeon Go 2024-11-05 20:01:34 +09:00
parent a8a13b539c
commit 5b264b64fd
8 changed files with 28 additions and 23 deletions

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Catswords")] [assembly: AssemblyCompany("Catswords")]
[assembly: AssemblyProduct("WelsonJS")] [assembly: AssemblyProduct("WelsonJS")]
[assembly: AssemblyCopyright("Catswords OSS, C-2021-000237, Opensource licensed under GPLv3 or MS-RL")] [assembly: AssemblyCopyright("Catswords OSS, Opensource licensed under GPLv3")]
[assembly: AssemblyTrademark("WelsonJS")] [assembly: AssemblyTrademark("WelsonJS")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다. // 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.7.31")] [assembly: AssemblyVersion("0.2.7.49")]
[assembly: AssemblyFileVersion("0.2.7.31")] [assembly: AssemblyFileVersion("0.2.7.49")]

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Catswords")] [assembly: AssemblyCompany("Catswords")]
[assembly: AssemblyProduct("WelsonJS")] [assembly: AssemblyProduct("WelsonJS")]
[assembly: AssemblyCopyright("Catswords OSS, C-2021-000237, Opensource licensed under GPLv3 or MS-RL")] [assembly: AssemblyCopyright("Catswords OSS, Opensource licensed under GPLv3")]
[assembly: AssemblyTrademark("WelsonJS")] [assembly: AssemblyTrademark("WelsonJS")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다. // 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.7.26")] [assembly: AssemblyVersion("0.2.7.49")]
[assembly: AssemblyFileVersion("0.2.7.26")] [assembly: AssemblyFileVersion("0.2.7.49")]

View File

@ -5,7 +5,7 @@
* HIGHT.cs * HIGHT.cs
* *
* description: * description:
* HIGHT(ISO/IEC 18033-3) cryptography algorithm (ECB mode) implementation for WelsonJS * HIGHT(ISO/IEC 18033-3) cryptography algorithm implementation
* *
* website: * website:
* - https://github.com/gnh1201/welsonjs * - https://github.com/gnh1201/welsonjs
@ -16,6 +16,7 @@
* - Namhyeon Go <abuse@catswords.net> * - Namhyeon Go <abuse@catswords.net>
* - @chandong83 (github.com) - Original author of CryptoHIGHT.cs * - @chandong83 (github.com) - Original author of CryptoHIGHT.cs
* - KISA(Korea Internet & Security Agency) * - KISA(Korea Internet & Security Agency)
* - Korea Unversity
* *
* references: * references:
* - https://github.com/chandong83/csharp_crypto_hight_ecb_examples * - https://github.com/chandong83/csharp_crypto_hight_ecb_examples

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Catswords")] [assembly: AssemblyCompany("Catswords")]
[assembly: AssemblyProduct("WelsonJS")] [assembly: AssemblyProduct("WelsonJS")]
[assembly: AssemblyCopyright("Catswords OSS, C-2021-000237, Opensource licensed under GPLv3 or MS-RL")] [assembly: AssemblyCopyright("Catswords OSS, Opensource licensed under GPLv3")]
[assembly: AssemblyTrademark("WelsonJS")] [assembly: AssemblyTrademark("WelsonJS")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다. // 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.7.22")] [assembly: AssemblyVersion("0.2.7.49")]
[assembly: AssemblyFileVersion("0.2.7.22")] [assembly: AssemblyFileVersion("0.2.7.49")]

View File

@ -225,7 +225,7 @@ namespace WelsonJS
} }
[ComVisible(true)] [ComVisible(true)]
public string EncryptStringHIGHT(string key, string data) public string EncryptString(string key, string data)
{ {
byte[] userKey = Encoding.ASCII.GetBytes(key); byte[] userKey = Encoding.ASCII.GetBytes(key);
byte[] dataIn = Encoding.UTF8.GetBytes(data); byte[] dataIn = Encoding.UTF8.GetBytes(data);
@ -235,7 +235,7 @@ namespace WelsonJS
} }
[ComVisible(true)] [ComVisible(true)]
public string DecryptStringHIGHT(string key, string encryptedData) public string DecryptString(string key, string encryptedData)
{ {
byte[] userKey = Encoding.ASCII.GetBytes(key); byte[] userKey = Encoding.ASCII.GetBytes(key);
byte[] dataIn = Convert.FromBase64String(encryptedData); byte[] dataIn = Convert.FromBase64String(encryptedData);

4
app.js
View File

@ -315,7 +315,7 @@ function require(pathname) {
}); });
break; break;
case ".enc": // protected script (HIGHT, ISO/IEC 18033-3) case ".enc": // encrypted script (require WelsonJS.Toolkit)
T = (function(data, o) { T = (function(data, o) {
try { try {
var s = '', i = 0, k = 6; var s = '', i = 0, k = 6;
@ -327,7 +327,7 @@ function require(pathname) {
i++; i++;
} }
if (i == k) return ''; if (i == k) return '';
return o.DecryptStringHIGHT(s, data); return o.DecryptString(s, data);
} catch (e) { } catch (e) {
console.error("Failed to load the encrypted data:", e.message); console.error("Failed to load the encrypted data:", e.message);
return ''; return '';

View File

@ -25,7 +25,7 @@ function main(args) {
} }
var data = FILE.readFile(filename, FILE.CdoCharset.CdoUTF_8); var data = FILE.readFile(filename, FILE.CdoCharset.CdoUTF_8);
var encryptedData = Toolkit.encryptStringHIGHT(userKey, data); var encryptedData = Toolkit.encryptString(userKey, data);
var dstfile = filename + ".enc"; var dstfile = filename + ".enc";
FILE.writeFile(dstfile, encryptedData, FILE.CdoCharset.CdoUTF_8); FILE.writeFile(dstfile, encryptedData, FILE.CdoCharset.CdoUTF_8);

View File

@ -1,5 +1,5 @@
// toolkit.js // toolkit.js
// WelsonJS native component interface for WelsonJS framework // WelsonJS native toolkit interface version 0.3.7
// Namhyeon Go <abuse@catswords.net> // Namhyeon Go <abuse@catswords.net>
// https://github.com/gnh1201/welsonjs // https://github.com/gnh1201/welsonjs
@ -93,12 +93,12 @@ function closeProcess(pid) {
return getInterface().CloseProcess(pid); return getInterface().CloseProcess(pid);
} }
function encryptStringHIGHT(userKey, data) { function encryptString(userKey, data) {
return getInterface().EncryptStringHIGHT(userKey, data); return getInterface().EncryptString(userKey, data);
} }
function decryptStringHIGHT(userKey, encryptedData) { function decryptString(userKey, encryptedData) {
return getInterface().DecryptStringHIGHT(userKey, encryptedData); return getInterface().DecryptString(userKey, encryptedData);
} }
exports.create = create; exports.create = create;
@ -112,10 +112,14 @@ exports.prompt = prompt;
exports.NamedSharedMemory = NamedSharedMemory; exports.NamedSharedMemory = NamedSharedMemory;
exports.openProcess = openProcess; exports.openProcess = openProcess;
exports.closeProcess = closeProcess; exports.closeProcess = closeProcess;
exports.encryptStringHIGHT = encryptStringHIGHT; exports.encryptString = encryptString;
exports.decryptStringHIGHT = decryptStringHIGHT; exports.decryptString = decryptString;
exports.VERSIONINFO = "WelsonJS native component interface (WelsonJS.Toolkit) version 0.3.6"; // compatiblity (below version 0.7.48)
exports.encryptStringHIGHT = encryptString;
exports.decryptStringHIGHT = decryptString;
exports.VERSIONINFO = "WelsonJS native toolkit interface version 0.3.7";
exports.AUTHOR = "abuse@catswords.net"; exports.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;