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 06:20
In what kind of attack can attackers make use of millions of computers under their control in an attack against a single server or network availability confidentiality integrity identity automated attack software? those who wrongfully disclose individually identifiable health information can be fined up to what amount per calendar year? single most expensive malicious attack hipaa what are script kiddies? advanced persistent threat security manager security engineer what level of security access should a computer user have to do their job what process describes using technology as a basis for controlling the access and usage of sensitive data? cybercriminal
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
When is it appropriate to use an absolute reference
Answers: 1
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
The idea that, for each pair of devices v and w, there’s a strict dichotomy between being “in range” or “out of range” is a simplified abstraction. more accurately, there’s a power decay function f (·) that specifies, for a pair of devices at distance δ, the signal strength f(δ) that they’ll be able to achieve on their wireless connection. (we’ll assume that f (δ) decreases with increasing δ.) we might want to build this into our notion of back-up sets as follows: among the k devices in the back-up set of v, there should be at least one that can be reached with very high signal strength, at least one other that can be reached with moderately high signal strength, and so forth. more concretely, we have values p1 ≥ p2 ≥ . . ≥ pk, so that if the back-up set for v consists of devices at distances d1≤d2≤≤dk,thenweshouldhavef(dj)≥pj foreachj. give an algorithm that determines whether it is possible to choose a back-up set for each device subject to this more detailed condition, still requiring that no device should appear in the back-up set of more than b other devices. again, the algorithm should output the back-up sets themselves, provided they can be found.\
Answers: 2
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
English, 22.02.2021 21:00
question
Social Studies, 22.02.2021 21:00
question
Mathematics, 22.02.2021 21:00
question
English, 22.02.2021 21:00
question
Mathematics, 22.02.2021 21:00
question
Mathematics, 22.02.2021 21:00
Questions on the website: 13722360