Write a function treble that takes a pointer to an integer and
triples its value. Note that this function does not return
anything. You can test it using the following example or something
similar:
int i=7;
cout << "old value; i="<<i<< "-"
treble(&i);cout <<"New Value:i="<< i
<<"\n";
Which prints: Old vvalue:i =7 - new value: i=21
In: Computer Science
Pick any simple game that is played on a mobile device or desktop/tablet or game console. For this discussion you should consider the pros and cons of playing the same game using different interfaces. Select two interfaces, other than the GUI and mobile ones (e.g. tangible, wearable, and shareable) and describe how the game could be redesigned for each of these, taking into account the user group being targeted. For example, the tangible game could be designed for young children, the wearable interface for young adults, and the shareable interface for elderly people.
In: Computer Science
Use any C program without using PTHREADS calculate time taken to execute program.
|
critical section |
|||
|
mutex solution |
|||
|
semaphore functions |
|||
|
Barriers |
|||
|
Read-Write Locks |
Run program using 1, 2, 4, and 8 threads Comparison study
|
Number of threads |
||||
|
Implementation |
1 |
2 |
4 |
8 |
|
critical section |
||||
|
mutex solution |
||||
|
semaphore functions |
||||
|
Barriers |
||||
|
Read-Write Locks |
||||
In: Computer Science
Draw a Schema Diagram using the information.
Signum Libri (SL) is a publishing company.
SL Operations Database will keep track of the following:
In: Computer Science
Write a C++ program that involves implementing the RSA cryptosystem. In practice for the encryption to be secure and to handle larger messages you would need to utilize a class for large integers. However, for this assignment you can use built-in types to store integers, e.g., unsigned long long int. Also, rather than using the ASCII table for this assignment use BEARCATII, which restricts the characters to the blank character and the lower-case letters of the alphabet as follows: blank character is assigned the value 0. A, …, Z are assigned the values 1, …, 26, respectively. The message M will be represented by replacing each character in the message with its assigned integer base 27. For example, the message M = “TEST” will be represented as N = 20 5 19 20 Translating this to decimal we obtain: D = 20 + 19*27 + 5*272 + 20*273 = 397838 Note that to convert back to base 27, we simply apply the algorithm we discussed in class, i.e., the least significant digit (rightmost) is obtained by performing the operations D mod 27 and performing a recursive call with D/27. For the example above we obtain, 397838 / 27, 397838 mod 27 = 14734, 20 → 14734 / 27, 14734 mod 27, 20 = 545, 19, 20 → 545/27, 545 mod 20, 19, 20 = 20, 5, 19, 20 = N Find primes p and q by choosing positive integers at random and testing for primality using Miller-Rabin probabilistic algorithm. Your program should prompt the user to input a positive integer representing the public key e. If the user enters a number that is not relatively prime to n = pq, then have the user reenter and keep doing this until e and n are coprime, i.e., gcd(e,φ(n)) = 1. Also prompt the user to enter the message M (as a character string). For handing purposes, run your program with M = “TEST”. Output p, q, n, M, C, P where C is the encrypted message, i.e., cyber text, and P is the decrypted message, i.e., plaintext. If your program is working correctly then M should be equal to P.
In: Computer Science
Laboratory Tasks
public class LinkedList {
Node head;
class Node {
int data;
Node next;
Node(int d) {
data = d;
next = null;
}
}
}
Complete the above java program by adding the following methods:
Part1:
In: Computer Science
Convert this C++ code to Java code
this code is to encrypt and decrypt strings of characters using Caesar cipher
please attach samples run of the code
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string>
#define MAX_SIZE 200
void encrypt_str(char xyz[], int key); // Function prototype for
the function to encrypt the input string.
void decrypt_str(char xyz[], int key); // Function prototype for
the function to decrypt the encrypted string.
using namespace std;
int main()
{
char input_str[MAX_SIZE];
int shift = 6; // This is the Caesar encryption key... You can
change it to whatever value you wish!
system("cls"); // System call to clear the console screen!
cout<<"\nEnter the string to be encrypted :\t";
gets(input_str); // Getting the user to input the string to be
encrypted!
cout<<"\nOriginal string:\t" << input_str;
// Function call to encrypt the input string
encrypt_str(input_str, shift);
return 0;
}
// Function Definition for the function to encrypt the input
string
void encrypt_str(char xyz[], int key){
char crypted_str[MAX_SIZE]; // To store the resulting string
int k=0; // For indexing purpose
char str;
while(xyz[k] !='\0') // Processing each character of the string
until the "end of line" character is met
{
str = toupper(xyz[k]); // Remove "toupper" from this line if you
don't wish to see the
// result string in Uppercase...
if(str != ' ') str += key;
{
if(str > 'z') str -=26;
{
crypted_str[k] = str;
k++;
}
}
}
crypted_str[k]='\0';
cout << "\nEncrypted string is:\t" << crypted_str; //
Displaying the Crypted String
// Function call to decrypt the encrypted string
decrypt_str(crypted_str, key);
}
// Function Definition for the function to decrypt the encrypted
string.
void decrypt_str(char xyz[], int key){
char decrypted_str[MAX_SIZE];
char str;
int k=0;
while(xyz[k] !='\0')
{
str = xyz[k];
if(str != ' ') str -= key;
{
if(str < 'A' && str !=' ') str += 26;
{
decrypted_str[k] = str;
k++;
}
}
}
decrypted_str[k]='\0';
cout << "\n Decrypted string is:\t" <<
decrypted_str;
}
In: Computer Science
Write a program that performs a merge-sort algorithm without
using a recursion. Only using pointers.
C++ programming language; #include<iostream>
In: Computer Science
3. Public Key Cryptography involves the use of two keys: a public key and a private key. Explain the use of each key
In: Computer Science
Programing language C++
In this exercise you will explore the performance difference between sequential search and binary search. To do so write a program that performs the following tasks:
Prompt the user for a file containing 100,000 unsorted integers
Read those integers into an array
Prompt the user for a search item
Search for that item (using sequential search) and report the number of comparisons required.
Sort the array. Note that this might take a few minutes.
Search for that item again (using binary search) and report the number of comparisons required.
You will need to modify both of the search functions to report the number of comparisons that were made during the search.
Use your program and the file of 100,000 integers provided here to answer the six questions in the quiz.
In: Computer Science
Activity 3: How does injection attack occur? (30 minutes)
Assume the web server includes the following code
sqlString = “select USERID from USER where USERID = ` $userId ` and PWD = ` $password `”
result = GetQueryResult(sqlString)
if(result = “”) then
userHasBeenAuthenticated = False
else
userHasBeenAuthenticated = True
end if
Here, $userId and $password are the values submitted by the user, and the query statement provides the quotation marks that set it as a literal string.
Critical Thinking Question
In: Computer Science
Activity 2: Injection Basics Injection attacks trick an application into including unintended commands in the data send to an interpreter.
Interpreters Interpret strings as commands such as SQL, shell (cmd.exe, bash)
Critical Thinking Questions: 1. What does a user/attacker see at the webpage? Where can an attacker enter exploit data/input? 2. Which entity builds user string input and send SQL query to Database server? 3. Which entity executes query including exploit and send back to web server and then user?
In: Computer Science
In: Computer Science
Reserve the memory for 2 students at compile time and make a menu which should allow user to add the student data one by one.
use c++ .
In: Computer Science
In a development organization that has the quality records of the software projects it has developed over the past 20 years, what is/are methods that should be considered first to estimate activity effort and duration. Explain why the methods(s) should be considered first.
In: Computer Science