From 5403d2125f71681e64979b52344ec6a69a902ecd Mon Sep 17 00:00:00 2001
From: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
Date: Mon, 2 Jun 2025 19:18:51 +0700
Subject: [PATCH] Upload files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
---
.gitignore | 5 ++
xaskel_coder/App.config | 6 ++
xaskel_coder/Program.cs | 87 ++++++++++++++++++++++
xaskel_coder/Properties/AssemblyInfo.cs | 33 +++++++++
xaskel_coder/Tea.cs | 54 ++++++++++++++
xaskel_coder/xaskel_coder.csproj | 54 ++++++++++++++
xaskel_decoder/App.config | 6 ++
xaskel_decoder/Program.cs | 88 +++++++++++++++++++++++
xaskel_decoder/Properties/AssemblyInfo.cs | 33 +++++++++
xaskel_decoder/Tea.cs | 56 +++++++++++++++
xaskel_decoder/xaskel_decoder.csproj | 54 ++++++++++++++
xaskel_soft.sln | 31 ++++++++
12 files changed, 507 insertions(+)
create mode 100644 .gitignore
create mode 100644 xaskel_coder/App.config
create mode 100644 xaskel_coder/Program.cs
create mode 100644 xaskel_coder/Properties/AssemblyInfo.cs
create mode 100644 xaskel_coder/Tea.cs
create mode 100644 xaskel_coder/xaskel_coder.csproj
create mode 100644 xaskel_decoder/App.config
create mode 100644 xaskel_decoder/Program.cs
create mode 100644 xaskel_decoder/Properties/AssemblyInfo.cs
create mode 100644 xaskel_decoder/Tea.cs
create mode 100644 xaskel_decoder/xaskel_decoder.csproj
create mode 100644 xaskel_soft.sln
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..93621e5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.vs
+bin/
+obj/
+packages/
+*.csproj.user
diff --git a/xaskel_coder/App.config b/xaskel_coder/App.config
new file mode 100644
index 0000000..193aecc
--- /dev/null
+++ b/xaskel_coder/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xaskel_coder/Program.cs b/xaskel_coder/Program.cs
new file mode 100644
index 0000000..1dd8c01
--- /dev/null
+++ b/xaskel_coder/Program.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace xaskel_coder
+{
+ internal class Program
+ {
+ private const int encodeSize = 3000; // byte count to encode
+ private static readonly List extensions = new List { ".col", ".txd", ".dff" };
+
+ static void Main()
+ {
+ Console.Write("Enter password: ");
+ string password = Console.ReadLine().Trim();
+ if (string.IsNullOrWhiteSpace(password))
+ return;
+
+ Console.Write("Getting files list... ");
+ List files = GetFiles(Console.ReadLine().Trim());
+ if (files.Count == 0)
+ return;
+ Console.WriteLine("Done.");
+
+ Console.Write("Encoding files... ");
+ foreach (string file in files)
+ {
+ EncryptFile(file, password);
+ }
+ Console.WriteLine("Done.");
+
+ Console.ReadLine();
+ }
+
+ static List GetFiles(string directoryPath)
+ {
+ List files = Directory.GetFiles(directoryPath, "*.*", SearchOption.TopDirectoryOnly)
+ .Where(file => extensions.Contains(Path.GetExtension(file).ToLower()))
+ .ToList();
+ return files;
+ }
+
+ static void EncryptFile(string filePath, string password)
+ {
+ string newFilePath = filePath + "rw";
+
+ using (var md5 = MD5.Create())
+ {
+ byte[] inputBytes = Encoding.UTF8.GetBytes(password),
+ hashBytes = md5.ComputeHash(inputBytes);
+ string key = BitConverter.ToString(hashBytes).Replace("-", "").Substring(0, 16);
+
+ byte[] data = File.ReadAllBytes(filePath);
+ int bytesToEncode = Math.Min(encodeSize, data.Length);
+
+ List encoded = new List();
+ for (int i = 0; i < bytesToEncode; i++)
+ {
+ encoded.Add(Tea.Encode(data[i].ToString(), key));
+ }
+
+ if (File.Exists(newFilePath))
+ {
+ File.Delete(newFilePath);
+ }
+
+ using (var fs = new FileStream(newFilePath, FileMode.CreateNew))
+ {
+ using (var writer = new BinaryWriter(fs))
+ {
+ string encodedString = string.Join("", encoded);
+ byte[] encodedBytes = Encoding.UTF8.GetBytes(encodedString);
+ writer.Write(encodedBytes);
+
+ if (data.Length > encodeSize)
+ {
+ writer.Write(data, encodeSize, data.Length - encodeSize);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/xaskel_coder/Properties/AssemblyInfo.cs b/xaskel_coder/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..ddec710
--- /dev/null
+++ b/xaskel_coder/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные с этой сборкой.
+[assembly: AssemblyTitle("xaskel_coder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("xaskel_coder")]
+[assembly: AssemblyCopyright("Lev Rusanov © 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM задайте для атрибута ComVisible этого типа значение true.
+[assembly: ComVisible(false)]
+
+// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
+[assembly: Guid("11ff5d14-ba40-434b-8b87-8031df3b1479")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Номер редакции
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/xaskel_coder/Tea.cs b/xaskel_coder/Tea.cs
new file mode 100644
index 0000000..11f44f3
--- /dev/null
+++ b/xaskel_coder/Tea.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Text;
+
+namespace xaskel_coder
+{
+ public static class Tea
+ {
+ private const uint DELTA = 0x9E3779B9;
+
+ public static string Encode(string text, string key)
+ {
+ if (string.IsNullOrEmpty(text))
+ return string.Empty;
+
+ byte[] textBytes = Encoding.UTF8.GetBytes(text),
+ keyBytes = Encoding.UTF8.GetBytes(key);
+
+ uint[] key32 = new uint[4];
+ Buffer.BlockCopy(keyBytes, 0, key32, 0, Math.Min(keyBytes.Length, 16));
+
+ int textLength = textBytes.Length,
+ bufferLength = textLength;
+
+ if (bufferLength % 4 != 0)
+ bufferLength += 4 - (bufferLength % 4);
+
+ bufferLength = bufferLength / 4;
+ uint[] text32 = new uint[bufferLength + 1];
+ Buffer.BlockCopy(textBytes, 0, text32, 0, textBytes.Length);
+
+ uint previous = 0;
+ for (int offset = 0; offset < bufferLength; offset++)
+ {
+ uint v = text32[offset],
+ sum = 0;
+
+ for (int i = 0; i < 32; i++)
+ {
+ v += (((previous << 4) ^ (previous >> 5)) + previous) ^ (sum + key32[sum & 3]);
+ sum += DELTA;
+ previous += (((v << 4) ^ (v >> 5)) + v) ^ (sum + key32[(sum >> 11) & 3]);
+ }
+
+ text32[offset] = v;
+ }
+ text32[bufferLength] = previous;
+
+ byte[] resultBytes = new byte[(bufferLength + 1) * 4];
+ Buffer.BlockCopy(text32, 0, resultBytes, 0, resultBytes.Length);
+
+ return Convert.ToBase64String(resultBytes);
+ }
+ }
+}
diff --git a/xaskel_coder/xaskel_coder.csproj b/xaskel_coder/xaskel_coder.csproj
new file mode 100644
index 0000000..9d942a2
--- /dev/null
+++ b/xaskel_coder/xaskel_coder.csproj
@@ -0,0 +1,54 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {11FF5D14-BA40-434B-8B87-8031DF3B1479}
+ Exe
+ xaskel_coder
+ xaskel_coder
+ v4.8
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xaskel_decoder/App.config b/xaskel_decoder/App.config
new file mode 100644
index 0000000..193aecc
--- /dev/null
+++ b/xaskel_decoder/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xaskel_decoder/Program.cs b/xaskel_decoder/Program.cs
new file mode 100644
index 0000000..196e2d9
--- /dev/null
+++ b/xaskel_decoder/Program.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace xaskel_decoder
+{
+ internal class Program
+ {
+ private const int blockSize = 12; // encoded block length
+ private const int encodeSize = 3000; // encoded byte count
+ private const int decodeSize = blockSize * encodeSize;
+ private static readonly string[] extensions = { ".colrw", ".colc", ".txdrw", ".txdc", ".dffrw", ".dffc" };
+
+ static void Main()
+ {
+ Console.Write("Enter password: ");
+ string password = Console.ReadLine().Trim();
+ if (string.IsNullOrWhiteSpace(password))
+ return;
+
+ Console.Write("Getting files list... ");
+ List files = GetFiles(Console.ReadLine().Trim());
+ if (files.Count == 0)
+ return;
+ Console.WriteLine("Done.");
+
+ Console.Write("Encoding files... ");
+ foreach (string file in files)
+ {
+ DecryptFile(file, password);
+ }
+ Console.WriteLine("Done.");
+
+ Console.ReadLine();
+ }
+
+ static List GetFiles(string directoryPath)
+ {
+ List files = Directory.GetFiles(directoryPath, "*.*", SearchOption.TopDirectoryOnly)
+ .Where(file => extensions.Contains(Path.GetExtension(file).ToLower()))
+ .ToList();
+ return files;
+ }
+
+ static void DecryptFile(string filePath, string password)
+ {
+ string newFilePath = filePath + ".decoded";
+
+ using (var md5 = MD5.Create())
+ {
+ byte[] inputBytes = Encoding.UTF8.GetBytes(password);
+ byte[] hashBytes = md5.ComputeHash(inputBytes);
+ string key = BitConverter.ToString(hashBytes).Replace("-", "").Substring(0, 16);
+
+ byte[] data = File.ReadAllBytes(filePath);
+ string fileContent = Encoding.UTF8.GetString(data);
+ int bytesToDecode = Math.Min(decodeSize, fileContent.Length);
+
+ List decodedBytes = new List();
+ for (int i = 0; i < bytesToDecode; i += blockSize)
+ {
+ int length = Math.Min(blockSize, bytesToDecode - i);
+ string block = fileContent.Substring(i, length);
+ string decrypted = Tea.Decode(block, key);
+ decodedBytes.AddRange(Encoding.UTF8.GetBytes(decrypted));
+ }
+
+ if (File.Exists(newFilePath))
+ {
+ File.Delete(newFilePath);
+ }
+
+ using (var fs = new FileStream(newFilePath, FileMode.CreateNew))
+ {
+ fs.Write(decodedBytes.ToArray(), 0, decodedBytes.Count);
+
+ if (data.Length > decodeSize)
+ {
+ fs.Write(data, decodeSize, data.Length - decodeSize);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/xaskel_decoder/Properties/AssemblyInfo.cs b/xaskel_decoder/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..e6a0ec1
--- /dev/null
+++ b/xaskel_decoder/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные с этой сборкой.
+[assembly: AssemblyTitle("xaskel_decoder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("xaskel_decoder")]
+[assembly: AssemblyCopyright("Lev Rusanov © 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM задайте для атрибута ComVisible этого типа значение true.
+[assembly: ComVisible(false)]
+
+// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
+[assembly: Guid("67779f52-b434-4645-a134-977977cfa8f3")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Номер редакции
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/xaskel_decoder/Tea.cs b/xaskel_decoder/Tea.cs
new file mode 100644
index 0000000..0939184
--- /dev/null
+++ b/xaskel_decoder/Tea.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Text;
+
+namespace xaskel_decoder
+{
+ public static class Tea
+ {
+ private const uint DELTA = 0x9E3779B9;
+
+ public static string Decode(string data, string key)
+ {
+ if (string.IsNullOrEmpty(data))
+ return string.Empty;
+
+ byte[] dataBytes = Convert.FromBase64String(data),
+ keyBytes = Encoding.UTF8.GetBytes(key);
+
+ uint[] key32 = new uint[4];
+ Buffer.BlockCopy(keyBytes, 0, key32, 0, Math.Min(keyBytes.Length, 16));
+
+ int dataLength = dataBytes.Length,
+ dataBlocks = dataLength / 4,
+ numPasses = dataBlocks - 1;
+
+ if (numPasses <= 0)
+ return string.Empty;
+
+ uint[] data32 = new uint[dataBlocks];
+ Buffer.BlockCopy(dataBytes, 0, data32, 0, dataBytes.Length);
+
+ uint previous = data32[numPasses];
+ for (int offset = numPasses - 1; offset >= 0; offset--)
+ {
+ uint v = data32[offset],
+ sum = 0xC6EF3720;
+
+ for (int i = 0; i < 32; i++)
+ {
+ previous -= (((v << 4) ^ (v >> 5)) + v) ^ (sum + key32[(sum >> 11) & 3]);
+ sum -= DELTA;
+ v -= (((previous << 4) ^ (previous >> 5)) + previous) ^ (sum + key32[sum & 3]);
+ }
+
+ data32[offset] = v;
+ }
+
+ int byteLength = dataBytes.Length - 5;
+ for (; byteLength >= 0 && dataBytes[byteLength] == 0; byteLength--) ;
+
+ byte[] resultBytes = new byte[byteLength + 1];
+ Buffer.BlockCopy(data32, 0, resultBytes, 0, resultBytes.Length);
+
+ return Encoding.UTF8.GetString(resultBytes);
+ }
+ }
+}
diff --git a/xaskel_decoder/xaskel_decoder.csproj b/xaskel_decoder/xaskel_decoder.csproj
new file mode 100644
index 0000000..ae9ffb3
--- /dev/null
+++ b/xaskel_decoder/xaskel_decoder.csproj
@@ -0,0 +1,54 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {67779F52-B434-4645-A134-977977CFA8F3}
+ Exe
+ xaskel_decoder
+ xaskel_decoder
+ v4.8
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xaskel_soft.sln b/xaskel_soft.sln
new file mode 100644
index 0000000..12fce84
--- /dev/null
+++ b/xaskel_soft.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35931.197 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xaskel_coder", "xaskel_coder\xaskel_coder.csproj", "{11FF5D14-BA40-434B-8B87-8031DF3B1479}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xaskel_decoder", "xaskel_decoder\xaskel_decoder.csproj", "{67779F52-B434-4645-A134-977977CFA8F3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {11FF5D14-BA40-434B-8B87-8031DF3B1479}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {11FF5D14-BA40-434B-8B87-8031DF3B1479}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {11FF5D14-BA40-434B-8B87-8031DF3B1479}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {11FF5D14-BA40-434B-8B87-8031DF3B1479}.Release|Any CPU.Build.0 = Release|Any CPU
+ {67779F52-B434-4645-A134-977977CFA8F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {67779F52-B434-4645-A134-977977CFA8F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {67779F52-B434-4645-A134-977977CFA8F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {67779F52-B434-4645-A134-977977CFA8F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5FFC7CAE-9DC6-4A24-86D4-EC1F83B47448}
+ EndGlobalSection
+EndGlobal