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).
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)
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
1. Implement the K-means algorithm using these two as a reference. 2.Use Matlab’s implementation of kmeans to check your results on the fisheriris dataset (https://www.mathworks.com/help/stats/kmeans.html) a. The fisheriris dataset is built into Matlab, and you can load it using ‘load fisheriris’. b. Please note the labels are available for the dataset, so you can check the performance of the kmeans algorithm on the dataset. 274 14 Unsupervised Lnn Fig. 14.1 A two-dimensional domain with clusters of examples weight bot initial...
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...
What strategies can we use in the implementation of a program to reduce std rates