//-------------------------------------- //--- 010 Editor v3.0.3 Script File // // File: XORSelection.1sc // Author: SweetScape Software, update Didier Stevens (https://DidierStevens.com) // Revision: 2.0 // Purpose: Xors the current selection // with a set of bytes, which causes // the bytes to be encoded so they // cannot be read by a human. Run the // Xor again on the encoded selection to // decode the data. //-------------------------------------- int i, iStart, size, iKeyLength; string sKey; // Check that a file is open if( FileCount() == 0 ) { MessageBox( idOk, "XORSelection", "XORSelection can only be executed when a file is loaded." ); return -1; } // Initializes the variables size = GetSelSize(); iStart = GetSelStart(); // Check that bytes were selected if( size == 0 ) { MessageBox( idOk, "XORSelection", "Please select bytes before running this script." ); return -1; } sKey = InputString("XORSelection", "Input the XOR key", ""); if (sKey == "") { MessageBox(idOk, "XORSelection", "Please enter a valid key."); return -1; } iKeyLength = Strlen(sKey); // Modify the selection for (i = 0; i < size; i++) // Modify the current byte WriteUByte(iStart + i, ReadUByte(iStart + i) ^ sKey[i % iKeyLength]);