Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //.h file code:
- using namespace System;
- public:
- String ^Encrypt(String ^CodeKey, String ^DataIn);
- String ^Decrypt(String ^CodeKey, String ^DataIn);
- ustub;
- /u;
- Public Function ^(ByVal CodeKey As String, ByVal DataIn As String) As String;
- Int64 lonDataPtr = 0;
- String ^strDataOut = nullptr;
- int intXOrValue1 = 0;
- int intXOrValue2 = 0;
- for (lonDataPtr = 1; lonDataPtr <= (DataIn->Length / 2.0); lonDataPtr++)
- {
- intXOrValue1 = Microsoft::VisualBasic::Conversion::Val("&H" + (DataIn->Substring((2 * lonDataPtr) - 2, 2)));
- intXOrValue2 = Convert::ToInt32(CodeKey[((lonDataPtr % CodeKey->Length) + 1) - 1]);
- strDataOut = strDataOut + (safe_cast<Char>(intXOrValue1 ^ intXOrValue2))->ToString();
- }
- xEncryption = strDataOut;
- }
- //.cpp file code:
- using namespace System;
- String ^<missing_class_definition>::Encrypt(String ^CodeKey, String ^DataIn)
- {
- Int64 lonDataPtr = 0;
- String ^strDataOut = nullptr;
- int temp = 0;
- String ^tempstring = nullptr;
- int intXOrValue1 = 0;
- int intXOrValue2 = 0;
- for (lonDataPtr = 1; lonDataPtr <= DataIn->Length; lonDataPtr++)
- {
- intXOrValue1 = Convert::ToInt32(DataIn[lonDataPtr - 1]);
- intXOrValue2 = Convert::ToInt32(CodeKey[((lonDataPtr % CodeKey->Length) + 1) - 1]);
- temp = (intXOrValue1 ^ intXOrValue2);
- tempstring = Convert::ToString(temp, 16)->ToUpper();
- if (tempstring->Length == 1)
- {
- tempstring = "0" + tempstring;
- }
- strDataOut = strDataOut + tempstring;
- }
- return strDataOut;
- }
- String ^<missing_class_definition>::Decrypt(String ^CodeKey, String ^DataIn)
- {
- Int64 lonDataPtr = 0;
- String ^strDataOut = nullptr;
- int intXOrValue1 = 0;
- int intXOrValue2 = 0;
- for (lonDataPtr = 1; lonDataPtr <= (DataIn->Length / 2.0); lonDataPtr++)
- {
- intXOrValue1 = Microsoft::VisualBasic::Conversion::Val("&H" + (DataIn->Substring((2 * lonDataPtr) - 2, 2)));
- intXOrValue2 = Convert::ToInt32(CodeKey[((lonDataPtr % CodeKey->Length) + 1) - 1]);
- strDataOut = strDataOut + (safe_cast<Char>(intXOrValue1 ^ intXOrValue2))->ToString();
- }
- return strDataOut;
- }
Add Comment
Please, Sign In to add comment