From 7aff1e4cb053394db57c2814d5fe1e6493e0cc75 Mon Sep 17 00:00:00 2001 From: watcherhd Date: Sat, 26 Nov 2011 14:19:43 +0000 Subject: Project folders rename part 2 git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@214 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- Dbx_mmap_SA/cryptors/rc4/cryptor.c | 133 ++++++++++++ Dbx_mmap_SA/cryptors/rc4/rc4.sln | 20 ++ Dbx_mmap_SA/cryptors/rc4/rc4.vcproj | 187 +++++++++++++++++ Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj | 264 ++++++++++++++++++++++++ Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.filters | 22 ++ Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.user | 3 + 6 files changed, 629 insertions(+) create mode 100644 Dbx_mmap_SA/cryptors/rc4/cryptor.c create mode 100644 Dbx_mmap_SA/cryptors/rc4/rc4.sln create mode 100644 Dbx_mmap_SA/cryptors/rc4/rc4.vcproj create mode 100644 Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj create mode 100644 Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.filters create mode 100644 Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.user (limited to 'Dbx_mmap_SA/cryptors/rc4') diff --git a/Dbx_mmap_SA/cryptors/rc4/cryptor.c b/Dbx_mmap_SA/cryptors/rc4/cryptor.c new file mode 100644 index 0000000..1f5f617 --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/cryptor.c @@ -0,0 +1,133 @@ +#include + +#define buf_size 1024 + +typedef struct{ + void* (__stdcall *GenerateKey)(char* key); + void (__stdcall *FreeKey)(void* key); + void (__stdcall *EncryptMem)(BYTE* data, int size, void* key); + void (__stdcall *DecryptMem)(BYTE* data, int size, void* key); + + char* Name; + char* Info; + char* Author; + char* Site; + char* Email; + + DWORD Version; + + WORD uid; +} Cryptor; + +typedef struct rc4_key +{ + BYTE state[256]; + BYTE x; + BYTE y; +} rc4_key; + +#define swap_byte(x,y) t = *(x); *(x) = *(y); *(y) = t + +void prepare_key(BYTE *key_data_ptr, size_t key_data_len, rc4_key *key) +{ + int i = 0; + BYTE t = 0; + BYTE index1 = 0; + BYTE index2 = 0; + BYTE* state = 0; + unsigned long counter = 0; + + state = &key->state[0]; + for(counter = 0; counter < 256; counter++) + state[counter] = (BYTE)counter; + key->x = 0; + key->y = 0; + index1 = 0; + index2 = 0; + for(counter = 0; counter < 256; counter++) + { + index2 = (key_data_ptr[index1] + state[counter] + index2) % 256; + swap_byte(&state[counter], &state[index2]); + index1 = (index1 + 1) % key_data_len; + } +} + +void rc4(BYTE *buffer_ptr, int buffer_len, rc4_key *key) +{ + BYTE t = 0; + BYTE x = 0; + BYTE y = 0; + BYTE* state = 0; + BYTE xorIndex = 0; + DWORD counter = 0; + BYTE old_state[256]; + + x = key->x; + y = key->y; + state = &key->state[0]; + memcpy(old_state, key->state, 256); + for(counter = 0; counter < (DWORD)buffer_len; counter++) + { + x = (x + 1) % 256; + y = (state[x] + y) % 256; + swap_byte(&state[x], &state[y]); + xorIndex = (state[x] + state[y]) % 256; + buffer_ptr[counter] ^= state[xorIndex]; + } + memcpy(key->state, old_state, 256); + //key->x = x; + //key->y = y; +} + + +void zero_fill(BYTE * pBuf, size_t bufSize) +{ + size_t i; + for(i = 0; i < bufSize; i++) + pBuf[i] = 0; +} + +void* __stdcall GenerateKey(char* pwd) +{ + rc4_key* key; + key = (rc4_key*)malloc(sizeof(rc4_key)); + zero_fill((BYTE*)key, sizeof(key)); + prepare_key(pwd, strlen(pwd), key); + return key; +} + +void __stdcall FreeKey(void* key) +{ + free(key); +} + +void __stdcall EncryptMem(BYTE* data, int size, void* key) +{ + rc4(data, size, key); +} + +void __stdcall DecryptMem(BYTE* data, int size, void* key) +{ + rc4(data, size, key); +} + +Cryptor cryptor = + { + GenerateKey, + FreeKey, + EncryptMem, + DecryptMem, + "RC4", + "Old, very easy to crack stream cipher", + "Unknown", + "http://ru.wikipedia.org/wiki/RC4", + "nomail", + 0x00000100, + 0xDEAD + }; + + +__declspec(dllexport) Cryptor* GetCryptor() +{ + return &cryptor; +} \ No newline at end of file diff --git a/Dbx_mmap_SA/cryptors/rc4/rc4.sln b/Dbx_mmap_SA/cryptors/rc4/rc4.sln new file mode 100644 index 0000000..2fefb62 --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/rc4.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rc4", "rc4.vcproj", "{E38B4212-53BC-49A7-B821-9A99DB4774C6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E38B4212-53BC-49A7-B821-9A99DB4774C6}.Debug|Win32.ActiveCfg = Debug|Win32 + {E38B4212-53BC-49A7-B821-9A99DB4774C6}.Debug|Win32.Build.0 = Debug|Win32 + {E38B4212-53BC-49A7-B821-9A99DB4774C6}.Release|Win32.ActiveCfg = Release|Win32 + {E38B4212-53BC-49A7-B821-9A99DB4774C6}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Dbx_mmap_SA/cryptors/rc4/rc4.vcproj b/Dbx_mmap_SA/cryptors/rc4/rc4.vcproj new file mode 100644 index 0000000..c725589 --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/rc4.vcproj @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj new file mode 100644 index 0000000..b60ab2c --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj @@ -0,0 +1,264 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release Unicode + Win32 + + + Release Unicode + x64 + + + Release + Win32 + + + Release + x64 + + + + {E38B4212-53BC-49A7-B821-9A99DB4774C6} + rc4 + Win32Proj + + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + Unicode + + + DynamicLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)/Plugins/cryptors/\ + $(SolutionDir)$(Configuration) x64/Plugins/cryptors/\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration) x64/Obj/$(ProjectName)\ + true + true + $(SolutionDir)$(Configuration)/Plugins/cryptors/\ + $(SolutionDir)$(Configuration) x64/Plugins/cryptors/\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration) x64/Obj/$(ProjectName)\ + false + false + $(SolutionDir)$(Configuration)/Plugins/cryptors/\ + $(SolutionDir)$(Configuration) x64/Plugins/cryptors/\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration) x64/Obj/$(ProjectName)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(OutDir)$(ProjectName).dll + true + Windows + MachineX86 + + + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(OutDir)$(ProjectName).dll + true + Windows + + + + + + + MaxSpeed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + $(OutDir)$(ProjectName).dll + true + Windows + true + true + MachineX86 + + + + + + + MaxSpeed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + $(OutDir)$(ProjectName).dll + true + Windows + true + true + + + + + + + MaxSpeed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + + + $(OutDir)$(ProjectName).dll + ../../../../lib;%(AdditionalLibraryDirectories) + true + $(OutDir)$(ProjectName).pdb + Windows + true + true + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;RC4_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + + + $(OutDir)$(ProjectName).dll + ../../../../lib;%(AdditionalLibraryDirectories) + true + $(OutDir)$(ProjectName).pdb + Windows + true + true + + + + + + + + + \ No newline at end of file diff --git a/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.filters b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.filters new file mode 100644 index 0000000..43730c5 --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.user b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/Dbx_mmap_SA/cryptors/rc4/rc4_10.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file -- cgit v1.2.3