Answer to Question #251522 in C++ for gary

Question #251522

Write C++ program: Lets create your first cipher!!! Cipher is an algorithm that you can use to encrypt and decrypt sensitive information. In an information system, sensitive information is stored in a 16-bit unsigned number, where bit-wise information is stored in following format, 9-bits are reserved for account number and 7-bits are reserved for customer ID.


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

C C C C C C C A A A A A A A A A


a) Using bit wise operators, write a function to extract customer ID

b) Another function to extract account number.

c) Due to security concerns, you have been given a task to create a cipher. Write a function to encrypt the 16-bit number (X) using the following expression.

y = aX + b, consider a = 5 and b = 233


d) Write another function to decrypt the number and display the original number.


1
Expert's answer
2021-10-14T16:04:15-0400
#include<iostream>


int extract_customer_ID(int number)
{
	int new_number = number >> 7;
	return new_number;
}


int extract_account_number(int number)
{
	int new_number = number >> 9;
	return new_number;
}


int encrypt_the_16(int number)
{
	int a = 5, b = 233;
	return number * a + b;
}


void decrypt_the_number(int number)
{
	int a = 5, b = 233;
	std::cout<<"The original number: "<<(number-b)/a<<std::endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS