subject

A common technique for obfuscating data is to use exclusive-or (XOR) with some key; it is inexpensive and symmetric. A problem occurs when this is used on file formats like portable executable where there are many null bytes, since XORing nulls with the key ends up writing the key out. A slightly more complex algorithm uses a Linear Feedback Shift Register (LFSR) to produce a key stream, which will be XORed with the data. A generic LFSR is:
If F is the value which represents the LFSR feedback and S is the current state of the LFSR, the next state of the LFSR is computed as follows:
if the lowest bit of Sis 0: S=S>>1
if the lowest bit of Sis 1: S=(S>>1)^F
For this challenge, you'll be using an LFSR with the feedback value 0x87654321. The LFSR is initialized with a value and stepped to produce the key stream. The next key value is read from the LFSR after eight steps, with the actual key being the lowest byte of the current LFSR value.
For example, if the initial value of the LFSR is 0x, then next value after stepping it eight times will be 0x9243F425, meaning that the first key byte is 0x25. If the first byte of the input is 0x41, the first byte of output will be 0x64.
Your task is to implement this algorithm (both LFSR and the XOR). We're only interested in algorithm implementation; other code will be discarded.
The function should adhere to one of following signatures:
C/C++
unsigned char *Crypt(unsigned char *data, int dataLength, unsigned int initialValue)
C#
static byte[] Crypt(byte[] data, uint initialValue)
Python
Crypt(data, initialValue) # returns byte string
Java
static byte[] Crypt(byte[] data, long initialValue)
Example Tests: data "apple"
dataLength 5
initialValue 0x12345678
result "\xCD\x01\xEF\xD7\x30"
data "\xCD\x01\xEF\xD7\x30"
dataLength 5
initialValue 0x12345678
result "apple"
Submit: Source code containing your implementation of the LFSR based encoding routine.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
You know the right answer?
A common technique for obfuscating data is to use exclusive-or (XOR) with some key; it is inexpensiv...
Questions
question
Biology, 23.04.2020 03:20
question
History, 23.04.2020 03:21
question
Mathematics, 23.04.2020 03:21
Questions on the website: 13722363