I don't want remember this bullshit, let's archive this repo

Signed-off-by: JDM170 <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2021-02-25 22:52:11 +07:00
parent abc57ae392
commit 05405ff5b7
15 changed files with 9209 additions and 261 deletions

View File

@@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="base64" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/base64" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="user32" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/base64" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="user32" />
</Linker>
</Target>
</Build>
<Unit filename="base64.cpp" />
<Unit filename="base64.h" />
<Unit filename="main.cpp" />
<Unit filename="main.h" />
<Extensions>
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@@ -1,93 +0,0 @@
#include "base64.h"
#include <iostream>
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
static inline bool is_base64(BYTE c) {
return (isalnum(c) || (c == '+') || (c == '/'));
}
std::string base64encode(BYTE const* buf, unsigned int bufLen) {
std::string ret;
int i = 0, j = 0;
BYTE char_array_3[3], char_array_4[4];
while(bufLen--) {
char_array_3[i++] = *(buf++);
if(i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(i = 0; i < 4; i++)
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
if(i) {
for(j = i; j < 3; j++)
char_array_3[j] = '\0';
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(j = 0; j < (i + 1); j++)
ret += base64_chars[char_array_4[j]];
while(i++ < 3)
ret += '=';
}
return ret;
}
std::vector<BYTE> base64decode(std::string const& encoded_string) {
int in_len = encoded_string.size(),
i = 0,
j = 0,
in_ = 0;
BYTE char_array_4[4], char_array_3[3];
std::vector<BYTE> ret;
while(in_len-- && (encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
char_array_4[i++] = encoded_string[in_];
in_++;
if(i == 4) {
for(i = 0; i < 4; i++)
char_array_4[i] = base64_chars.find(char_array_4[i]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for(i = 0; i < 3; i++)
ret.push_back(char_array_3[i]);
i = 0;
}
}
if(i) {
for(j = i; j < 4; j++)
char_array_4[j] = 0;
for(j = 0; j < 4; j++)
char_array_4[j] = base64_chars.find(char_array_4[j]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for(j = 0; j < (i - 1); j++)
ret.push_back(char_array_3[j]);
}
return ret;
}

View File

@@ -1,17 +0,0 @@
# depslib dependency file v1.0
1600530854 source:c:\users\jdm17\desktop\base64\base64.cpp
"base64.h"
<iostream>
1600530854 c:\users\jdm17\desktop\base64\base64.h
<vector>
<string>
1601296249 source:c:\users\jdm17\desktop\base64\main.cpp
"main.h"
"base64.h"
1601297599 c:\users\jdm17\desktop\base64\main.h
<windows.h>
<string>

View File

@@ -1,11 +0,0 @@
#ifndef _BASE64_H_
#define _BASE64_H_
#include <vector>
#include <string>
typedef unsigned char BYTE;
std::string base64encode(BYTE const*, unsigned int);
std::vector<BYTE> base64decode(std::string const&);
#endif

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="main.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="334" topLine="6" />
</Cursor>
</File>
<File name="main.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="242" topLine="0" />
</Cursor>
</File>
<File name="base64.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="959" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@@ -1,37 +0,0 @@
#include "main.h"
#include "base64.h"
// a sample exported function
void DLL_EXPORT SomeFunction(const LPCSTR sometext)
{
MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);
}
extern "C" DLL_EXPORT std::string Base64Encode(BYTE const* buf, unsigned int bufLen)
{
return base64encode(buf, bufLen);
}
extern "C" DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}

View File

@@ -1,30 +0,0 @@
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
/* To use this exported function of dll, include this header
* in your project.
*/
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
//#include <string>
void DLL_EXPORT SomeFunction(const LPCSTR sometext);
//std::string DLL_EXPORT Base64Encode(unsigned char const* buf, unsigned int bufLen);
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__

View File

@@ -75,8 +75,8 @@ namespace Utils
public string Base64Decode(string base64EncodedData)
{
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
foreach (var i in base64EncodedBytes)
Console.WriteLine(" " + i);
// foreach (var i in base64EncodedBytes)
// Console.WriteLine(" " + i);
return Encoding.UTF8.GetString(base64EncodedBytes);
}
#endregion

91
utils/UI_design_Qt.ui Normal file
View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Main</class>
<widget class="QDialog" name="Main">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>320</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>320</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>320</height>
</size>
</property>
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Шифровка файлов</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>381</width>
<height>301</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="files_list"/>
</item>
<item row="1" column="0">
<widget class="QProgressBar" name="progress_bar">
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="choose_files">
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Выбрать файлы</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="encode_files">
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Зашифровать</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

9116
utils/server.log Normal file

File diff suppressed because it is too large Load Diff

BIN
utils/src_base64_C#.zip Normal file

Binary file not shown.

Binary file not shown.