How can we know when the code implementation of a cryptographic algorithm is correct to use? Justify your answer.
Cryptiographic: when the program converts the plan text to cipher text and cipher text to the plan text.
Then we can say that that code is correctly implemented the cryptographic. The following example will explain the cryptographic encryption and decryption.
Encryption: converts the plain text to cipher text
Decryption: Coneverts the cipher text to plain text
C++ Source Code:
#include<iostream>
using namespace std;
int main()
{
char data[100], ch;
int i, cryptokey;
char choice[1];
do
{
cout<<"\nEnter your choice \n
E->Encryption\nD->Decryption\nQ->Quit\n";
cin>>choice;
if(choice[0]=='e' || choice[0]=='E')
{
cout << "Enter a message to encrypt: ";
cin>>data;
cout << "Enter key: ";
cin >> cryptokey;
for(i = 0; data[i] != '\0'; ++i){
ch = data[i];
if(ch >= 'a' && ch <= 'z'){
ch = ch + cryptokey;
if(ch > 'z'){
ch = ch - 'z' + 'a' - 1;
}
data[i] = ch;
}
else if(ch >= 'A' && ch <= 'Z'){
ch = ch + cryptokey;
if(ch > 'Z'){
ch = ch - 'Z' + 'A' - 1;
}
data[i] = ch;
}
}
cout << "Encrypted message: " << data;
}
else if(choice[0]=='d' || choice[0]=='D')
{
cout << "Enter a message to decrypt: ";
cin>>data;
cout << "Enter key: ";
cin >> cryptokey;
for(i = 0; data[i] != '\0'; ++i){
ch = data[i];
if(ch >= 'a' && ch <= 'z'){
ch = ch - cryptokey;
if(ch < 'a'){
ch = ch + 'z' - 'a' + 1;
}
data[i] = ch;
}
else if(ch >= 'A' && ch <= 'Z'){
ch = ch - cryptokey;
if(ch > 'a'){
ch = ch + 'Z' - 'A' + 1;
}
data[i] = ch;
}
}
cout << "Decrypted message: " << data;
}
}while(choice[0]!='Q');
return 0;
}
Output:
Enter your choice
E->Encryption
D->Decryption
Q->Quit
E
Enter a message to encrypt: hemanth
Enter key: 5
Encrypted message: mjrfsym
Enter your choice
E->Encryption
D->Decryption
Q->Quit
D
Enter a message to decrypt: mjrfsym
Enter key: 5
Decrypted message: hemanth
Enter your choice
E->Encryption
D->Decryption
Q->Quit
Q
How can we know when the code implementation of a cryptographic algorithm is correct to use?...
1.Dijkstra's Algorithm [10 pt] In class, we have discussed an implementation of Dijkstra's Algorithm using min-heap. Analyze the worst-case running time of an implementation of this algorithm using unordered linked-list (as the data structure for d(v), the upper bound on the shortest distance from source s to v). Give your answer in e. Justify your answer (and state any assumptions you make).
Suppose that your implementation of a particular algorithm appears in Java as for (int pass = 1; pass<=n; pass++) { for (int index = 0; index<n; index++) { for (int count = 1; count<10; count++) { The previous code shows only the repetitions in the algorithm, not the computations that occur within the loops. These computations, however, are independent of n. what is the order of the algorithm? Justify your answer.
When using a linked list for stack implementation, we use the first Node as the top entry of stack. Explain, in this linked list implementation, how we add and how we remove an entry from a stack. Use linked nodes diagrams to save your time. add remove
How can we know when something we are reading rises to a level of a literary work?
how can we know when something we are reading rises to the level of a literary work? literature english
10. Indicate the runtime complexity of Dijkstra's algorithm when the implementation is not based on a binary min-heap. PLEASE, JUST THE FINAL ANSWER, DO NOT EXPLAIN.
hi i need help with b and e. I know when secondary and tertiary
we use E1 mechanism and when primary E2. Please can you see if
correct and explain the mechanism E2 and if it was primary how it
would be with E1
H2SO4 e. (hint rearrangement)
Create an implementation for the Gale-Shapley algorithm, determine its time complexity. you will need to write up your implementation and discuss the data structures that you select and the time complexity of your algorithm. You can use pseudocode, but more concrete
I C language how do we know when to return 0; and when to return a value.Give a code example for each type and explain
Probabilities: Sampling Means Now that we know when we can use the normal distribution, we can use the Empirical Rule and the Normal Table (opens in new window) to find the probabilities. Example 1 Recall our earlier scenario: The Federal Pell Grant Program provides need-based grants to low-income undergraduate and certain post-baccalaureate students to promote access to post-secondary education. According to the National Post-secondary Student Aid Study conducted by the U.S. Department of Education in 2008, the average Pell grant...