Question

In: Computer Science

1. A company that wants to send data over the Internet will use an encryption program...

1. A company that wants to send data over the Internet will use an encryption program to ensure data security. All data will be transmitted as four-digit integers. The application should read a four-digit integer entered by the user and encrypt it as follows:  Replace each digit with the remainder of the new value divided by 10 by adding 6 to the digit. Then replace the number in the first digit with the third, and the number in the second digit with the fourth. Print the encrypted integer on the screen.  Write a separate application where an encrypted four-digit integer is entered and decrypted (reversing the encryption scheme) and finds the original number.

Note: code should be written in Java Language.

Solutions

Expert Solution

import java.util.*;

public class Main
{
        public static void main(String[] args) {
            Scanner sc= new Scanner(System.in);
                System.out.println("Enter a 4-digit number");
                int n= sc.nextInt();    //input of the number
                int ar[]=new int[4];   //array to store all digits
                int i=3;       //counter variable
                
                while(n>0)     //loop to store each digit in the array
                {
                    ar[i]=n%10;
                    n/=10;
                    i--;
                }
                for( i=0;i<4;i++)    //loop to calculate the original digit of the number
                {
                    ar[i]= (ar[i]+6)%10;
                }
                
                int temp=ar[2];   //swapping 1st and 3rd digit
                ar[2]=ar[0];
                ar[0]=temp;
                
                temp=ar[3];      //swapping 2nd and 4th digit
                ar[3]=ar[1];
                ar[1]=temp;
                
                System.out.println("The original number is :");
                for( i=0;i<4;i++)                  //loop to ptint original digits of the number.
                System.out.print(ar[i]);   
        }
}

Related Solutions

1) A company that wants to send data over the Internet will use an encryption program...
1) A company that wants to send data over the Internet will use an encryption program to ensure data security. All data will be transmitted as four-digit integers. The application should read a four-digit integer entered by the user and encrypt it as follows:  Replace each digit with the remainder of the new value divided by 10 by adding 6 to the digit. Then replace the number in the first digit with the third, and the number in the...
1. A company that wants to send data over the Internet will use an encryption program...
1. A company that wants to send data over the Internet will use an encryption program to ensure data security. All data will be transmitted as four-digit integers. The application should read a four-digit integer entered by the user and encrypt it as follows:  Replace each digit with the remainder of the new value divided by 10 by adding 6 to the digit. Then replace the number in the first digit with the third, and the number in the...
A company that wants to send data over the Internet has asked you to write a...
A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your application should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first...
A company that wants to send data over the Internet has asked you to write a...
A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your application should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first...
For encryption, what does it mean for data to be in transition and in use? What...
For encryption, what does it mean for data to be in transition and in use? What are the major security concerns with data encryption?
If two applications use TCP to send data but only send 10 bytes per segment (e.g....
If two applications use TCP to send data but only send 10 bytes per segment (e.g. by using the push operation), what is the maximum percent of the network bandwidth they will have for their data?
Write a program using interrupts to get data serially and send it to P2 while at...
Write a program using interrupts to get data serially and send it to P2 while at the same time Timer 0 is generating a square wave of 5 kHz. We've been basing our code on the Intel 8051 microntroller and assembly language.
C++. How do I reverse this encryption? Here is the question: "A company that wants to...
C++. How do I reverse this encryption? Here is the question: "A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your program should read a four-digit integer in main() entered by the user and encrypt it as follows: 1. Replace each digit with the result of adding 7 to the digit and...
Internet Marketing: Whats internet Marketing? Discuss an existing company that use internet marketing? how it use...
Internet Marketing: Whats internet Marketing? Discuss an existing company that use internet marketing? how it use Internet marketing to promote one of its products? which product and why? what are the benefit of internet marketing ? Support Information: As in any new industry or concept, the Internet has its share of confusing buzzwords and jargon. A website produced by Matisse Enzer, presents a comprehensive glossary of Internet terms. http://www.matisse.net/files/glossary.html Many traditional elements of marketing easily translate into Internet marketing such...
SnoopPro is a global company specializing in communications security. The company monitors over 1 billion Internet...
SnoopPro is a global company specializing in communications security. The company monitors over 1 billion Internet messages per day and recently reported that 70% of emails are spam. Suppose your inbox contains 25 messages. Let X be the number of messages that are spam. What is P(16 ≤ X ≤ 20)? If a sample of size n = 64 is selected from a population with mean E(X) = 50 and standard deviation SD(X) = 8, then the probability that the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT