Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C language: Implement function confidentiality_xor that gets a 32-bit encryption key (key) as argument, the encrypted data (data) along with its length (len) as

In C language:

Implement function confidentiality_xor that gets a 32-bit encryption key (key) as argument, the encrypted data (data) along with its length (len) as arguments. The length is indicated as the number of 32-bit blocks the data contains. The function should implement a simple encryption: each 32-bit data buffer will be encrypted using the XOR-bitwise operation using the encryption key. The function does not need to allocate memory, i.e., it operates on the data buffer directly. Note: the data should be handled as 32-bit unsigned integers (uint32_t data type in stdint.h header). More information in Wikipedia.

Implement also function confidentiality_xor_shift that, in addition to encrypting the data, will modify the encryption key after each 32-bit block. The function works otherwise similarly as the above one, but after each operation it shifts the bits in the key one step left. At each shift, the most significant (leftmost) bit it transferred to the other end, i.e. to represent the least significant (rightmost) bit. The modified key will be used on next encryption block, after which it is again modified, and so on.

Here are the definitions of the functions from the file:

/* * Encrypts / decrypts the void* buffer named * Encrypted data will be saved to the same -buffer. * Encryption is based on XOR operation using a 32-bit */ void confidentiality_xor(uint32_t key, void* data, int len) { }

/* * Encrypts / decrypts the void* buffer named * Encrypted data will be saved to the same -buffer. * Encryption is based on XOR operation using a 32-bit * After encrypting one 32-bit block of original data, the key shifts one bit left */ void confidentiality_xor_shift(uint32_t key, void* data, int len) { }

void print_uint32_hex(void* data, int len) { for(int i = 0; i < len; i++) printf("0x%08x ", ((uint32_t*)data)[i]); printf(" "); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago