مشفر النصوص (لتحويل النصوص إلى شفرة)

    • مشفر النصوص (لتحويل النصوص إلى شفرة)

      السلام عليكم


      برنامج يسمح لك بتشفير النص بكلمة مرور و بنفس كلمة المرور يمكنك فك شفرة النص
      البرنامج تجدونه على المرفقات شفرة لا بأس بجودتها ... في أمان الله




      جميع الحقوق محفوضة ناقوس الخطر
    • وهذه وظائف التشفير لمن يريد الإستفادة منها

      C++6

      MFC


      PHP كود المصدر

      1. le="color: #000000"><?php CString _StringEncrypt(CString STR,CString Password);CString _StringDecrypt(CString STR,CString Password);static unsigned int BitXOR(unsigned int x, unsigned int y, unsigned int z);



      هذه الوظيفة الأولى لتشفير النص

      PHP كود المصدر

      1. le="color: #000000"><?php CString _StringEncrypt(CString STR ,CString Password){CString StrResult,TXT,OutTxt;INT L = 0;UINT N=0;for (int M = 1; M <= STR.GetLength(); M++){TXT = STR.Left(M).Right(1);int Modified = BitXOR(TXT.GetAt(0),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}StrResult = "";StrResult.Format(_T("%d"), Modified);sscanf(StrResult.GetBuffer(0),"%d",&N);StrResult.Format("%X",N);OutTxt.Insert(OutTxt.GetLength(),StrResult.Right(2));}return OutTxt;}
      عرض الكل



      وهذه الوظيفة الثانية لفك التشفير


      PHP كود المصدر

      1. le="color: #000000"><?php CString _StringDecrypt(CString STR ,CString Password){CString StrResult,OutTxt,iStr;INT L = 0;UINT N=0;for (int M = 2; M <= STR.GetLength(); M += 2){iStr = STR.Left(M).Right(2);sscanf(iStr.GetBuffer(0),"%x",&N);iStr.Format("%u",N);int Modified = BitXOR(_ttoi(iStr),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}OutTxt.Insert(OutTxt.GetLength(),(char) Modified);}return OutTxt;}
      عرض الكل



      وهذه وظيفة لعملية bitwise exclusive OR

      PHP كود المصدر

      1. le="color: #000000"><?php inline unsigned int BitXOR(unsigned int x, unsigned int y, unsigned int z){ return x ^ y ^ z;}


      في أمان الله

    • طريقة اخرى أفضل من السابقة لتشفير مترجمة من Autoit و إلى C++6

      من المرفقات تجدون المثال جاهز مع التطبيق

      وهذه هي جميع الوظائف

      في أمان الله

      AutoitEncrypt_C++Decrypt

      PHP كود المصدر

      1. le="color: #000000"><?php FileDelete("Encrypt.txt")FileDelete("Decrypt.txt")$sHTML = ""$sHTML &= "<HTML>" & @CRLF$sHTML &= "<HEAD>" & @CRLF$sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CRLF$sHTML &= "</HEAD>" & @CRLF$sHTML &= "<FRAMESET rows='25,200'>" & @CRLF$sHTML &= " <FRAME NAME=Top SRC=about:blank>" & @CRLF$sHTML &= " <FRAMESET cols='100,500'>" & @CRLF$sHTML &= " <FRAME NAME=Menu SRC=about:blank>" & @CRLF$sHTML &= " <FRAME NAME=Main SRC=about:blank>" & @CRLF$sHTML &= " </FRAMESET>" & @CRLF$sHTML &= "</FRAMESET>" & @CRLF$sHTML &= "</HTML>";Decrypt;COMMAND _StringEncrypt_.exe Space i_Encrypt = 0 Space sFilePath Space Password Space Level $TXT = _StringEncrypt(1, $sHTML, "Autoit", 5)$FO = FileOpen("Encrypt.txt",1)FileWriteLine($FO, $TXT)FileClose($FO)$COMMAND = "_StringEncrypt_.exe" & " " & "0" & " " & "Encrypt.txt" & " " & "Autoit" & " " & "5"Run($COMMAND, "", @SW_HIDE) Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1) If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then SetError(1) Return '' ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then SetError(1) Return '' Else If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1 Local $v_EncryptModified Local $i_EncryptCountH Local $i_EncryptCountG Local $v_EncryptSwap Local $av_EncryptBox[256][2] Local $i_EncryptCountA Local $i_EncryptCountB Local $i_EncryptCountC Local $i_EncryptCountD Local $i_EncryptCountE Local $v_EncryptCipher Local $v_EncryptCipherBy If $i_Encrypt = 1 Then For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1 $i_EncryptCountG = '' $i_EncryptCountH = '' $v_EncryptModified = '' For $i_EncryptCountG = 1 To StringLen($s_EncryptText) If $i_EncryptCountH = StringLen($s_EncryptPassword) Then $i_EncryptCountH = 1 Else $i_EncryptCountH += 1 EndIf $v_EncryptModified = $v_EncryptModified & Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255)) Next $s_EncryptText = $v_EncryptModified $i_EncryptCountA = '' $i_EncryptCountB = 0 $i_EncryptCountC = '' $i_EncryptCountD = '' $i_EncryptCountE = '' $v_EncryptCipherBy = '' $v_EncryptCipher = '' $v_EncryptSwap = '' $av_EncryptBox = '' Local $av_EncryptBox[256][2] For $i_EncryptCountA = 0 To 255 $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1)) $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA Next For $i_EncryptCountA = 0 To 255 $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256) $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0] $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0] $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap Next For $i_EncryptCountA = 1 To StringLen($s_EncryptText) $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256) $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256) $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0] $v_EncryptCipherBy = BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountA, 1)), $i_EncryptCountE) $v_EncryptCipher &= Hex($v_EncryptCipherBy, 2) Next $s_EncryptText = $v_EncryptCipher Next Else For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1 $i_EncryptCountB = 0 $i_EncryptCountC = '' $i_EncryptCountD = '' $i_EncryptCountE = '' $v_EncryptCipherBy = '' $v_EncryptCipher = '' $v_EncryptSwap = '' $av_EncryptBox = '' Local $av_EncryptBox[256][2] For $i_EncryptCountA = 0 To 255 $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1)) $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA Next For $i_EncryptCountA = 0 To 255 $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256) $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0] $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0] $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap Next For $i_EncryptCountA = 1 To StringLen($s_EncryptText) Step 2 $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256) $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256) $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0] $v_EncryptCipherBy = BitXOR(Dec(StringMid($s_EncryptText, $i_EncryptCountA, 2)), $i_EncryptCountE) $v_EncryptCipher = $v_EncryptCipher & Chr($v_EncryptCipherBy) Next $s_EncryptText = $v_EncryptCipher $i_EncryptCountG = '' $i_EncryptCountH = '' $v_EncryptModified = '' For $i_EncryptCountG = 1 To StringLen($s_EncryptText) If $i_EncryptCountH = StringLen($s_EncryptPassword) Then $i_EncryptCountH = 1 Else $i_EncryptCountH += 1 EndIf $v_EncryptModified &= Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255)) Next $s_EncryptText = $v_EncryptModified Next EndIf Return $s_EncryptText EndIfEndFunc ;==>_StringEncryptƒo??÷ ?/¾w+E›@??"´7œ¯*mjëh?×6FileDelete("Encrypt.txt")FileDelete("Decrypt.txt")$TXT = "" & @CRLF$TXT &= "Features: " & @CRLF$TXT &= " " & @CRLF$TXT &= "Easy to learn BASIC-like syntax " & @CRLF$TXT &= "Simulate keystrokes and mouse movements " & @CRLF$TXT &= "Manipulate windows and processes " & @CRLF$TXT &= "Interact with all standard windows controls " & @CRLF$TXT &= "Scripts can be compiled into standalone executables " & @CRLF$TXT &= "Create Graphical User Interfaces (GUIs) " & @CRLF$TXT &= "COM support " & @CRLF$TXT &= "Regular expressions " & @CRLF$TXT &= "Directly call external DLL and Windows API functions " & @CRLF$TXT &= "Scriptable RunAs functions " & @CRLF$TXT &= "Detailed helpfile and large community-based support forums " & @CRLF$TXT &= "Compatible with Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008 " & @CRLF$TXT &= "Unicode and x64 support " & @CRLF$TXT &= "Digitally signed for peace of mind " & @CRLF$TXT &= "Works with Windows Vista's User Account Control (UAC) " & @CRLF $FO = FileOpen("Decrypt.txt",2)$FR = FileWriteLine($FO ,$TXT) FileClose($FO) ;Encrypt;COMMAND _StringEncrypt_.exe Space i_Encrypt = 1 Space sFilePath Space Password Space Level$COMMAND = "_StringEncrypt_.exe" & " " & "1" & " " & "Decrypt.txt" & " " & "Autoit" & " " & "5"RunWait($COMMAND, "", @SW_HIDE)$FO = FileOpen("Encrypt.txt",0)$FR = FileReadLine($FO)FileClose($FO)$TXT = _StringEncrypt(0, $FR, "Autoit", 5)FileDelete("Decrypt.txt")$FO = FileOpen("Decrypt.txt",2)$FR = FileWriteLine($FO,$TXT) FileClose($FO) Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1) If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then SetError(1) Return '' ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then SetError(1) Return '' Else If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1 Local $v_EncryptModified Local $i_EncryptCountH Local $i_EncryptCountG Local $v_EncryptSwap Local $av_EncryptBox[256][2] Local $i_EncryptCountA Local $i_EncryptCountB Local $i_EncryptCountC Local $i_EncryptCountD Local $i_EncryptCountE Local $v_EncryptCipher Local $v_EncryptCipherBy If $i_Encrypt = 1 Then For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1 $i_EncryptCountG = '' $i_EncryptCountH = '' $v_EncryptModified = '' For $i_EncryptCountG = 1 To StringLen($s_EncryptText) If $i_EncryptCountH = StringLen($s_EncryptPassword) Then $i_EncryptCountH = 1 Else $i_EncryptCountH += 1 EndIf $v_EncryptModified = $v_EncryptModified & Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255)) Next $s_EncryptText = $v_EncryptModified $i_EncryptCountA = '' $i_EncryptCountB = 0 $i_EncryptCountC = '' $i_EncryptCountD = '' $i_EncryptCountE = '' $v_EncryptCipherBy = '' $v_EncryptCipher = '' $v_EncryptSwap = '' $av_EncryptBox = '' Local $av_EncryptBox[256][2] For $i_EncryptCountA = 0 To 255 $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1)) $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA Next For $i_EncryptCountA = 0 To 255 $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256) $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0] $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0] $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap Next For $i_EncryptCountA = 1 To StringLen($s_EncryptText) $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256) $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256) $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0] $v_EncryptCipherBy = BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountA, 1)), $i_EncryptCountE) $v_EncryptCipher &= Hex($v_EncryptCipherBy, 2) Next $s_EncryptText = $v_EncryptCipher Next Else For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1 $i_EncryptCountB = 0 $i_EncryptCountC = '' $i_EncryptCountD = '' $i_EncryptCountE = '' $v_EncryptCipherBy = '' $v_EncryptCipher = '' $v_EncryptSwap = '' $av_EncryptBox = '' Local $av_EncryptBox[256][2] For $i_EncryptCountA = 0 To 255 $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1)) $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA Next For $i_EncryptCountA = 0 To 255 $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256) $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0] $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0] $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap Next For $i_EncryptCountA = 1 To StringLen($s_EncryptText) Step 2 $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256) $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256) $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0] $v_EncryptCipherBy = BitXOR(Dec(StringMid($s_EncryptText, $i_EncryptCountA, 2)), $i_EncryptCountE) $v_EncryptCipher = $v_EncryptCipher & Chr($v_EncryptCipherBy) Next $s_EncryptText = $v_EncryptCipher $i_EncryptCountG = '' $i_EncryptCountH = '' $v_EncryptModified = '' For $i_EncryptCountG = 1 To StringLen($s_EncryptText) If $i_EncryptCountH = StringLen($s_EncryptPassword) Then $i_EncryptCountH = 1 Else $i_EncryptCountH += 1 EndIf $v_EncryptModified &= Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255)) Next $s_EncryptText = $v_EncryptModified Next EndIf Return $s_EncryptText EndIfEndFunc ;==>_StringEncrypt
      عرض الكل




      C++6 functions

      Declaration

      PHP كود المصدر

      1. le="color: #000000"><?php CString _StringEncrypt(CString STR,CString Password,int Level = 1);CString _StringDecrypt(CString STR,CString Password,int Level = 1);int BitXOR(int x,int y,int z);int Mod(int x , int y);int Bit_XOR(int x ,int y);


      Definition

      PHP كود المصدر

      1. le="color: #000000"><?php [code]CString _StringEncrypt(CString STR ,CString Password,int Level){for (int M = 0; M <= Level; M++){CString StrResult,StrL,STR2;int L = 0;for (int M = 1; M <= STR.GetLength(); M++){StrL = STR.Left(M).Right(1);int Modified = BitXOR(StrL.GetAt(0),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}STR2.Insert(STR2.GetLength(),(char) Modified);}STR = STR2; int EncryptBox[256][2];CString StrM;for (M = 0; M <= 255; M++){StrM = Password.Left(Mod(M,Password.GetLength()) + 1).Right(1);EncryptBox[M][1] = StrM.GetAt(0);EncryptBox[M][0] = M;} int B = 0 , Swap = 0;for (M = 0; M <= 255; M++){B = Mod((B + EncryptBox[M][0] + EncryptBox[M][1]), 256);Swap = EncryptBox[M][0];EncryptBox[M][0] = EncryptBox[B][0];EncryptBox[B][0] = Swap;}int C = 0 , D = 0 , E = 0 , By = 0 , N = 0;CString StrN,StrFormat,Cipher;for (M = 1; M <= STR.GetLength(); M++){C = Mod((C + 1), 256);D = Mod((D + EncryptBox[C][0]), 256);E = EncryptBox[Mod((EncryptBox[C][0] + EncryptBox[D][0]), 256)][0];StrN = STR.Left(M).Right(1);By = Bit_XOR(StrN.GetAt(0),E);StrFormat = "";StrFormat.Format(_T("%d"), By);sscanf(StrFormat.GetBuffer(0),"%d",&N);StrFormat.Format("%X",N);Cipher.Insert(Cipher.GetLength(),StrFormat.Right(2));} STR = Cipher;}return STR;} CString _StringDecrypt(CString STR ,CString Password,int Level){for (int M = 0; M <= Level; M++){CString StrResult,StrL,STR2;int L = 0;int EncryptBox[256][2];CString StrM;for (int M = 0; M <= 255; M++){StrM = Password.Left(Mod(M,Password.GetLength()) + 1).Right(1);EncryptBox[M][1] = StrM.GetAt(0);EncryptBox[M][0] = M;} int B = 0 , Swap = 0;for (M = 0; M <= 255; M++){B = Mod((B + EncryptBox[M][0] + EncryptBox[M][1]), 256);Swap = EncryptBox[M][0];EncryptBox[M][0] = EncryptBox[B][0];EncryptBox[B][0] = Swap;} int C = 0 , D = 0 , E = 0 , By = 0 , N = 0;CString StrN,StrFormat,Cipher;for (M = 2; M <= STR.GetLength(); M+= 2){C = Mod((C + 1), 256);D = Mod((D + EncryptBox[C][0]), 256);E = EncryptBox[Mod((EncryptBox[C][0] + EncryptBox[D][0]), 256)][0];StrFormat = STR.Left(M).Right(2);sscanf(StrFormat.GetBuffer(0),"%x",&N);StrFormat.Format("%u",N);By = Bit_XOR(_ttoi(StrFormat),E);Cipher.Insert(Cipher.GetLength(),(char) By);}STR = Cipher;for (M = 1; M <= STR.GetLength(); M++){StrL = STR.Left(M).Right(1);int Modified = BitXOR(StrL.GetAt(0),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}STR2.Insert(STR2.GetLength(),(char) Modified);}STR = STR2;}return STR;}int Bit_XOR(int x,int y){ return x ^ y;}int BitXOR(int x,int y,int z){ return x ^ y ^ z;}int Mod(int x , int y){return x % y;}
      عرض الكل






      C ++ 6

      Win32 Console Application

      An application that supports MFC

      PHP كود المصدر

      1. le="color: #000000"><?php // _StringEncrypt_.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "_StringEncrypt_.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endifCString _StringEncrypt(CString STR,CString Password,int Level = 1);CString _StringDecrypt(CString STR,CString Password,int Level = 1);int BitXOR(int x,int y,int z);int Mod(int x , int y);int Bit_XOR(int x ,int y);void File_Write(CString EncryptFile,CString Str);CString File_Read(CString EncryptFile);/////////////////////////////////////////////////////////////////////////////// The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]){ int nRetCode = 0; // initialize MFC and print and error on failure if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: change error code to suit your needs cerr << _T("Fatal Error: MFC initialization failed") << endl; nRetCode = 1; } else { CString Str; if ((CString) argv[1] == (CString) "1") { Str = File_Read(argv[2]); Str = _StringEncrypt(Str ,argv[3],_ttoi(argv[4])); File_Write("Encrypt.txt",Str); cout << (LPCTSTR)"Ok"<< endl; } if ((CString) argv[1] == (CString) "0") { Str = File_Read(argv[2]); Str = _StringDecrypt(Str ,argv[3],_ttoi(argv[4])); File_Write("Decrypt.txt",Str); cout << (LPCTSTR)"Ok"<< endl; } } return nRetCode;} CString _StringEncrypt(CString STR ,CString Password,int Level){for (int M = 0; M <= Level; M++){CString StrResult,StrL,STR2;int L = 0;for (int M = 1; M <= STR.GetLength(); M++){StrL = STR.Left(M).Right(1);int Modified = BitXOR(StrL.GetAt(0),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}STR2.Insert(STR2.GetLength(),(char) Modified);}STR = STR2; int EncryptBox[256][2];CString StrM;for (M = 0; M <= 255; M++){StrM = Password.Left(Mod(M,Password.GetLength()) + 1).Right(1);EncryptBox[M][1] = StrM.GetAt(0);EncryptBox[M][0] = M;} int B = 0 , Swap = 0;for (M = 0; M <= 255; M++){B = Mod((B + EncryptBox[M][0] + EncryptBox[M][1]), 256);Swap = EncryptBox[M][0];EncryptBox[M][0] = EncryptBox[B][0];EncryptBox[B][0] = Swap;}int C = 0 , D = 0 , E = 0 , By = 0 , N = 0;CString StrN,StrFormat,Cipher;for (M = 1; M <= STR.GetLength(); M++){C = Mod((C + 1), 256);D = Mod((D + EncryptBox[C][0]), 256);E = EncryptBox[Mod((EncryptBox[C][0] + EncryptBox[D][0]), 256)][0];StrN = STR.Left(M).Right(1);By = Bit_XOR(StrN.GetAt(0),E);StrFormat = "";StrFormat.Format(_T("%d"), By);sscanf(StrFormat.GetBuffer(0),"%d",&N);StrFormat.Format("%X",N);Cipher.Insert(Cipher.GetLength(),StrFormat.Right(2));} STR = Cipher;}return STR;} CString _StringDecrypt(CString STR ,CString Password,int Level){for (int M = 0; M <= Level; M++){CString StrResult,StrL,STR2;int L = 0;int EncryptBox[256][2];CString StrM;for (int M = 0; M <= 255; M++){StrM = Password.Left(Mod(M,Password.GetLength()) + 1).Right(1);EncryptBox[M][1] = StrM.GetAt(0);EncryptBox[M][0] = M;} int B = 0 , Swap = 0;for (M = 0; M <= 255; M++){B = Mod((B + EncryptBox[M][0] + EncryptBox[M][1]), 256);Swap = EncryptBox[M][0];EncryptBox[M][0] = EncryptBox[B][0];EncryptBox[B][0] = Swap;} int C = 0 , D = 0 , E = 0 , By = 0 , N = 0;CString StrN,StrFormat,Cipher;for (M = 2; M <= STR.GetLength(); M+= 2){C = Mod((C + 1), 256);D = Mod((D + EncryptBox[C][0]), 256);E = EncryptBox[Mod((EncryptBox[C][0] + EncryptBox[D][0]), 256)][0];StrFormat = STR.Left(M).Right(2);sscanf(StrFormat.GetBuffer(0),"%x",&N);StrFormat.Format("%u",N);By = Bit_XOR(_ttoi(StrFormat),E);Cipher.Insert(Cipher.GetLength(),(char) By);}STR = Cipher;for (M = 1; M <= STR.GetLength(); M++){StrL = STR.Left(M).Right(1);int Modified = BitXOR(StrL.GetAt(0),Password.GetAt(L), 255);if (L == Password.GetLength() - 1) {L = 0;} else {L++;}STR2.Insert(STR2.GetLength(),(char) Modified);}STR = STR2;}return STR;}int Bit_XOR(int x,int y){ return x ^ y;}int BitXOR(int x,int y,int z){ return x ^ y ^ z;}int Mod(int x , int y){return x % y;} void File_Write(CString EncryptFile,CString Str){CFile file;if (file.Open(EncryptFile, CFile::modeCreate|CFile::modeWrite)){CFileStatus status;if(CFile::GetStatus( EncryptFile, status )){file.Write(Str.GetBuffer(0),Str.GetLength());}}} CString File_Read(CString EncryptFile){CFile file;const int MAX_BUFFER_SIZE = 65536;int nSize = 0;char szBuffer[MAX_BUFFER_SIZE+1];CString TXTR;CFileStatus status;if (file.Open(EncryptFile, CFile::modeRead | CFile::typeBinary | CFile::shareDenyNone)){if(CFile::GetStatus( EncryptFile, status )){while(true){nSize = file.Read(szBuffer,MAX_BUFFER_SIZE);if(nSize <= 0)break;szBuffer[nSize] = '\0';TXTR += szBuffer;}}}return TXTR;}
      عرض الكل




    • تم إضافة خيار جديد لفتح ملف لأن لصق النص على نظام الويندوس الإنجليزي لنصوص العربية تحدث
      معه بعض المشاكل في حال عدم تثبيت اللغة بصورة كاملة الفتح المباشر للملف يتفادى حدوث هذه
      المشكلة البرنامج المعدل من المرفقات