Write a JAVA program that reads from the keyboard a small password and then offers two options:
1. enter your name and a filename to save or
2. enter a file name to load.
With the option 1 proceed to save to the file an encrypted version of your name (details below), with the option 2 proceed to load the information from the file and decrypt the name and print it to the screen. The options 1 and 2 are in reverse (1 saves the encrypted information to the file, 2 decrypts the information from the file). Details of the encryption: Say your name is Andrei and you chose the password 1234, then you do XOR between the ASCII code for A (first letter in your name) and the ASCII code for 1(first letter in your password), I will denote this operation (A,1) then you do XOR between n and 2 (n,2) (second letter in your name with second letter in password) and so on, thus we will have the following operations to perform: (A,1) (n,2) (d,3) (r,4) (e,1) (i,2). Obviously, if you would choose the password qwer then the XOR operations will be between the following pairs: (A,q)(n,w)(d,e)(r,r)(e,q)(i,w). The trick is that the encrypted text can be decrypted due to the following property of XOR: A XOR B=C; C XOR B=A, thus if I have the results of the XOR operations in the file (and this is your name encrypted) then it is sufficient to do XOR with the same password (with the same ASCII codes) and I will get back the original string. For example, with the first password, (A XOR 1) XOR 1 =A, (n XOR 2) XOR 2=n and so on: ((A,1),1) ((n,2),2) ((d,3),3) ((r,4),4) ((e,1),1) ((i,2),2)= A n d r e i.

Answers

Answer 1

To write a Java program in that conditions you will need to use the following concepts:

ASCII codes - to perform the XOR operations with the given passwordXOR operator - to encrypt and decrypt the nameReading/writing to files - to save and load the encrypted information

You can use the following Java code to read a small password and then offer two options:

Scanner in = new Scanner(System.in);
System.out.print("Please enter a small password: ");
String password = in.nextLine();

System.out.println("Please choose one of the following options:");
System.out.println("1. Enter your name and a filename to save");
System.out.println("2. Enter a file name to load");

int option = in.nextInt();
switch (option) {
 case 1:
   // Enter your name and a filename to save
   break;
 case 2:
   // Enter a filename to load
   break;
 default:
   System.out.println("Invalid option!");
}

Then you can use the ASCII codes of each letter of the name and the password to perform the XOR operations and encrypt/decrypt the name. After that, you can save the encrypted information to a file and load it again when needed.

Learn more about ASCII code https://brainly.com/question/18844544

#SPJ11


Related Questions

you work at a large department store selling computer products. iwina walks in and wants to buy a wireless router. she explains that the media streaming device she ordered online supports a transmission speed of up to 200 mbps. what type of router should you recommend?

Answers

If Iwina's media streaming device supports a transmission speed of up to 200 Mbps, I would recommend a wireless router that supports at least 802.11n wireless standard.

What is a 802.11n wireless standard?

802.11n is a wireless networking standard that operates on both the 2.4 GHz and 5 GHz frequency bands. It offers higher speeds and greater range compared to earlier wireless standards, and is commonly used in home and small business networks.

Thus, if Iwina's media streaming device supports a transmission speed of up to 200 Mbps, I would recommend a wireless router that supports at least 802.11n wireless standard. This wireless standard supports a theoretical maximum speed of up to 600 Mbps, which should provide enough bandwidth to support Iwina's device. Alternatively, a router that supports the newer 802.11ac wireless standard could also be considered, as it offers even higher theoretical speeds.

Learn more about wireless router on:

https://brainly.com/question/30079964

#SPJ1

you are the administrator for the westsim domain. organizational units (ous) have been created for each company department. user and computer accounts for each department have been moved into their respective department ous.

Answers

As an administrator for the Westsim domain, the Organizational Units (OUs) have been created for each company department. All user and computer accounts for each department have been moved into their respective department OUs.

An Organizational Unit (OU) is a container object within an Active Directory that can contain other objects, including other OUs. OUs are created to facilitate the administration of users, computers, and other directory objects. An OU can have policies and permissions applied to it that are distinct from those of other OUs. These containers organize objects within the AD, making it simpler to implement administrative assignments and deploy Group Policy Objects (GPOs). What is Active Directory (AD)?Active Directory (AD) is a directory service that is utilized in Windows environments to centrally manage authentication and authorization for users, computers, and other network resources. It works by combining information about user accounts, computer accounts, and other resources into a central database.

Learn more about Organizational Units (OUs): https://brainly.com/question/13440440

#SPJ11

Other Questions
fill in the blank. a___is a consultant with a background in behavioral sciences who can be a catalyst in helping organizations deal with old problems in new ways. (b) Write 5 as a percentage. you work at a large department store selling computer products. iwina walks in and wants to buy a wireless router. she explains that the media streaming device she ordered online supports a transmission speed of up to 200 mbps. what type of router should you recommend? how should you write the volume dispensed by a 5 ml volumetric pipet? Sally has 3:4 as many beads as Kelly. Kelly has 18 more beads than Sally. Find the average number of beads the girl have how is the beat divided in this selection? a. long-shorts in the drum during the guitar solo. b. short-short-short-short or four quicker notes. c. short-short or two quicker notes on each beat. d. long-shorts or three quicker notes on each beat. Current Liabilities and Ratios Several accounts that appeared on Kruse's 2017 balance sheet are as follows: Accounts Payable $55,000 Equipment $950,000 Marketable Securities 40,000 Taxes Payable 15,000 Accounts Receivable 180,000 Retained Earnings 250,000 Notes Payable, 12%, due in 60 days 20,000 Inventory 85,000 Capital Stock 1,150,000 Allowance for Doubtful Accounts 20,000 Salaries Payable 10,000 Land 600,000 Cash 15,000 Required: 1. Prepare the Current Liabilities section of Kruse's 2017 balance sheet. Kruse Partial Balance Sheet As Of December 31, 2017 Current liabilities: Accounts payable $ 55,000 Notes payable, 12%, due in 60 days 20,000 Taxes payable 15,000 Salaries payable 10,000 Total current liabilities $ 100,000 Feedback Prepare the liabilities section of the balance sheet. 2. Compute Kruse's working capital. __ 3. Compute Kruse's current ratio. __: 1 davon watched his father recoil from a snake in fear. now he is afraid of snakes. this apparent acquisition of fear of snakes is an example of: group of answer choices modeling. response discrimination. escape response. stimulus generalization. hydroelectric, wind, geothermal, and parabolic solar collection all rely on spinning turbines (connected to a generator) to produce electricity. explain how each provides the force to do so. Identify each of the following orbitals, and determine the n and quantum numbers. Explain your answers. 1. Name four changes that occur in your body when you feel stress 2. You and your friend are studying for a test. Your friend seems calm while you are getting a headache and tense muscles. How will a positive attitude help you manage stress? Answer both questions with one paragraph please and thank you! Either use an appropriate theorem to show that the given set, W, is a vector space, or find a specific example to the contrary.W = {[\begin{array}{ccc}a\\b\\c\\\d\end{array}\right] : 3a+b=c, a+b+2c=2d} If written backwards the number one thousand, one hundred twenty-five, would be written as five thousand, two hundred eleven.'yes or no? In a survey of 124 pet owners, 44 said they own a dog, and 58 said they own a cat. 14 said they own both a dog and a cat. How many owned neither a cat nor a dog? t/f prisons are violent mainly because they house large numbers of people who disobey social norms. Martin has a spinner that is divided into four sections labeled A, B, C, and D. He spins the spinner twice. PLEASE ANSWER RIGHT HELP EASY THANK UUDrag the letter pairs into the boxes to correctly complete the table and show the sample space of Martin's experiment.. Maria purchased 1,000 shares of stock for $35. 50 per share in 2014. She sold them in 2016 for $55. 10 per share. Express her capital gain as a percent, rounded to the nearest tenth of a percent in a sanger sequencing reaction, deoxyribonucleotides terminate a replicating segment of dna, while dideoxyribonucleotides allow it to continue.T/F ne al Compute the derivative of the given function. TE f(x) = - 5x^pi+6.1x^5.1+pi^5.1 an organization provides in service treatment for alcoholic clients and receives virutally all of these referrals from the family service agencies this is an example of what kind of relationship?