//-------------------------------------- //--- 010 Editor v2.0 Script File // // File: XORSelection.1sc // Author: SweetScape Software // Revision: 1.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, pos, keypos, size; // Build the key - modify this to use your own key const int KEY_LENGTH = 8; uchar key[ KEY_LENGTH ] = { 'P', 'A', 'S', 'S', 'W', 'O', 'R', 'D' }; // 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(); pos = GetSelStart(); keypos = 0; i = 0; // Check that bytes were selected if( size == 0 ) { MessageBox( idOk, "XORSelection", "Please select bytes before running this script." ); return -1; } // Modify the selection while( i < size ) { // Modify the current byte WriteUByte( pos, ReadUByte(pos) ^ key[keypos] ); // Advance to the next byte i++; pos++; keypos++; if( keypos == KEY_LENGTH ) keypos = 0; }