C++ :: Number X Is Encrypted - Decrypt Function?
Jun 19, 2014
I am to use this cipher in which the number x is encrypted
(a and c are known numbers)
Also, what will the decrypt function be? Actually, i need to find the decryption formula...below is the code i tried to test...
char x = 'a';
cout<<x1<<endl<<x2<<endl;
cout<<x1<<endl<<x2<<endl;
View 6 Replies
ADVERTISEMENT
Nov 20, 2014
i have an executable that is encrypted; it is made in Visual C++. decrypt it? what i must to look for? I have some kind of files (.req extention) that have the content encoded by password type.
View 2 Replies
View Related
Jan 5, 2015
I have got to create a program that will gather input from the user and then encrypt & decrypt those characters.
I'm not very confident at coding so I'm sure many parts of my code are written poorly and not following the best practice so I have written a simple version of an algorithm where the program simply adds/subtracts a value of 2 to/from the ASCII values but I have discovered the use of the rand() and srand functions but I'm unsure how to go about using them within both my encrypt and decrypt function as a single value (static variable?).
Here is my code in its entirety at the moment.
#include <iostream >
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
char getMenuSelection (char m);
void encrypt (char key[]);
void decrypt (char code[]);
[code]....
This code currently doesn't execute due to ' undefined reference to 'encrypt(char*) '
Question
I am asking how to generate the random number and incorporate this into my encrypt and decrypt functions.
1. Would the use of a static or global variable make this work as is?
2. Would I need to create separate class files for both functions?
View 2 Replies
View Related
Apr 3, 2015
I have an application which needs to connect to a database. It runs in the background so there is no user input. I therefore need to store the connection string. I want to encrypt the connection details and then store the encrypted information. My thinking is I would read the encrypted details, from wherever I store them, unencrypt them and then connect to my database.
I've done a bit of reading on this and the SHA1CryptoServiceProvider method seems like an option but it appears that this cannot be unencrypted.
So how can I use this encrypted information?
Or is there another method?
View 1 Replies
View Related
Feb 5, 2013
How can decrypt the file that the program below encrypt?
// This program encrypts a file
#include<iostream>
#include<fstream>
using namespace std;
int main() {
const int ENCRYPT=10; // amount to add to a chor
const int SIZE= 255; // array size
[Code]...
View 2 Replies
View Related
Oct 3, 2013
I need to decrypt my text file and make it able to read in my program..
What I have programmed so far is to read the encrypted file, create a new file, decrypt it and read the newly created file..
I need to decrypt the encrypted file without having to create a new file that reads the decrypted text..
Well, Let me show you my code:
P.S Most of the include is not needed and I already know that Visual studio 2010 Windows Form Application CLR
Code:
#pragma once
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
[Code].....
You have my decryption code and the code I want to use..
I have uploaded the code for you to use on your computer because it is fairly hard for me to explain..
I want to be able to read the encrypted file in my program, without having to writing a new file to decrypt it..
Decrypted & Encrypted .txt file Included (And images)
--> Program .rar pack link <--
Build it with Visual Studio 2010
View 5 Replies
View Related
Nov 3, 2013
I have been working on some C++ code that doesn't seem to be going right. I'm wanting it to read a (three-digit) integer representing the value to be encrypted, a (one-digit) integer representing the encryption key, encrypt the value and print the encrypted value. The encrypting method used is that each digit in the given number is replaced by ((the sum of that digit plus key) modulo 10) then the first and last “encrypted” digits are swapped.
For example, if the number entered was 216 and the key given was 7, after applying the encryption procedure described the first digit (2) would become 9, the middle digit (1) would become 8 and the last digit (6) would become 3. The first and last encrypted digits are then swapped. The program displays the encrypted number: that is 389 in this case.
#include <iostream>
using namespace std;
int main() {
int isolateDigits();
int replaceDigits();
int swapDigit1withDigit3();
[Code] ....
View 1 Replies
View Related
Sep 27, 2013
I need to be able to actually read my encrypted file..
I have the decryption code and works perfectly when running it through console app c++.
But, the way I decrypt is to decrypt from a file, and create a new file which is decrypted.
I can't use that kind of code in my program in windows form app c++..
I need to read the encrypted text file and decrypt it in memory while using it for my program..
Some links to my codes I use at the moment.
My decryption coded in console application: [URL] ....
My decryption code edited for form application (Did not do anything) [URL] ....
And this is the code I tried to read after it got decrypted (Reading file written in combobox_selectedindexchange: [URL] ....
View 2 Replies
View Related
May 24, 2014
For my purpose all I need to know is drive's BitLocker encryption status by its DOS path. Something like this:
Code:
enum DriveEncryptionStatus{
Unprotected,
Protected,
Unknown
};
DriveEncryptionStatus = GetDriveBitlockerEncryptionStatus(L"C:");
I was able to find the Win32_EncryptableVolume class that unfortunately comes with this caveat:
To use the Win32_EncryptableVolume methods, the following conditions must be met:
You must have administrator privileges.
How to do this without running as an administrator?
View 4 Replies
View Related
Oct 9, 2013
I was told to use a round function to round a number to give an integer number that is closer to the real value. (for example if the number is 114.67 I need to print an int value of 115 instead of 114)
I am not exactly sure how a round function works, but I am told to include math.h library. What I try doesn't seem to work.
View 1 Replies
View Related
Nov 3, 2013
What I have is a main function that takes input characters from the command prompt during the main function call, and coverts it to an integer array a using atoi. (starting at the 2nd character - the 1st is reserved for another call that I plan to reference later, and the 0th is obviously the ./function). A function is then called to find the mode of an array (the range of values in the array is 1-30). Now, when I run the whole thing, I get a segmentation fault (core dumped) for even number of arguments. It's late and I've been staring at it for too long...
Code:
#include <stdio.h>
#include <stdlib.h>
int get_mode(int a[], int count);
[Code]......
View 1 Replies
View Related
Oct 10, 2013
How would I write a function that determines if a number is a multiple of another number.ex. (is 147 a multiple of 7?)
View 5 Replies
View Related
Jun 16, 2013
i just search random function, there are random function using rand();but when i compile this code
Code:
#include <stdio.h>
int main(){
int a;
a = rand();
printf("%d",a);
}
[code].....
i ask to you that is function to generate the number, why the number is cannot generate
View 6 Replies
View Related
Mar 6, 2015
I have this code(homework) i've been working on for several days i couldn't fix this error.
Question is: to write a sort program in c . Ineed to ask user for how many numbers to be sorted(n) ask again for values. The approach of sort is this:
1- store n in temporary var (temp)
2- search for largest number in array (0 until temp-1)
3- switch the fied that store largest with field indexed by (temp-1)
4- temp-- (decrement)
5- repeat steps 2 to 4 until temp is 1
the program then prints the numbers of array on screen in one line. I also should use a function getMax(int *list , int n) that determines largest value and returns its location in that array
list : is the array
n: number of elements
Code:
#include<stdio.h>
int getMax(int *list, int n); //definition of getMax function
int main(void) {
int n,i;
[Code] .....
so i tried to sort this array
Code:
input 2 7 9 4 3 1 6 5
The out put should be : 9 7 6 5 4 3 2 1
instead it prints : 7 9 2 4 3 1 6
View 11 Replies
View Related
Mar 19, 2014
So in this function it is already passing the array into the function but the thing is one parameter being passed into the function and if so how do I go about passing 3 arrays as parameters into the function? Also the program only asks for a user entry of hours for three different cars so why would there be a point in making two additional arrays to be passed into the function?
#include <iostream>
#include <iomanip>
using namespace std;
//passing array into function
double calculateCharges(double hours[], int HoursArrayLocation);//call function
[Code] ....
View 12 Replies
View Related
Aug 19, 2013
i'm trying building my how Write() function:
template <typename T>
....
Write(T Argument1[,T ArgumentX])
how can i calculate the numeber of Arguments added? (in C we used an argument for tells how many we putted in a function, but not in these case)
View 2 Replies
View Related
Apr 23, 2013
In my program, i have a function, example: bool open(string szString); this function i have known it's fix address, example: 0x12345678 Because of my computer which has low capability, if this function is called 1000 times per second it will be hanged, slow. So i want limit the number of function call down to 500 times per second. how will i do with C/C++?
View 2 Replies
View Related
Nov 25, 2014
#include <stdio.h>
#include <iostream>
#include <cstdlib>
[Code]....
View 1 Replies
View Related
Mar 28, 2013
I have this simple code here:
Code:
#include <iostream>
int multiply (double x, double y) {
double result = x*y;
return (result);
[Code] ....
I get the answer 5.94 (which is what I'm looking for). I can't work out why the first example is not outputting a decimal number. I have set the variables as a double so I just can't see why this is not working for me.
View 1 Replies
View Related
Feb 1, 2014
I wrote a function to count the number of characters in a string. Curious as to why I have to return x-1 and why x isn't the number of characters.
Code:
int count(char *string){
55 int x = 0;
56 char *p;
57 p = string;
58
[Code] .....
View 4 Replies
View Related
Nov 15, 2014
I use rand function to generate a number which consists of 3-5 digits(e.134,1435,73463..). The user decides whether he wants a 3 digit,4 digit or 5 digit number.After that,the user tries to guess the number.Its like mastermind game.The user will enter a number (with the same amount of digits) and the program will calculate how many digits from the secret number he has found and also how many digits he has found in the correct position(e.if the generatir produces the number 32541 and the user tries the number 49581 the program should tell him that he found 3 digits (5,1,4) and 2 digits in the correct position(5,1)) so that after some tries he finds the secret number.My problem is with the functions so that i can compare the digit of each number,find the amount of same digits and the amount of digits in same position.
View 5 Replies
View Related
Aug 28, 2013
I just want to practice in the language so i wrote this simple function that computes the factorial result of a certain number. The problem is that for all numbers > 20, the results are wrong ( < 20 all good).
I already learned that normal "long" type in c is more like 32 bit int and not 64 bit like a long type in java. so I used here a "long long" type.
why am I getting strange results above the number 20? isn't 64 bit enough to hold those numbers?
Code:
long long factorial(int n);
int main() {
long long result = factorial(20);
printf("%lld",result);
[code] ...
for 21 i get: -4249290049419214848
where the right result shoud be: 51,090,942,171,709,440,000
View 8 Replies
View Related
Mar 15, 2013
C programming, make it use a function call to print the smallest number? this is a program which prints out the smallest of three numbers within the main function that I was asked to write.Now the other question i am asked,5. Re-write the program, uses a function call to print the smallest number?
Code:
# include <stdio.h>
main()
{
int a,b,c;
int temp, min;
a = 100;
b = 23;
c = 5;
}
[code]....
View 5 Replies
View Related
May 18, 2013
I am supposed to write a recursive function which find the partition of a number n ,, for example if n=3 , it should print 1 1 1 , 1 2 , 3
I wrote the program but i am getting the two partition 1 2 and 2 1 which are the same ,, how can i avoid that ?
this is the code :
void PrintPartition( int n , int A[] , int j ) {
if( n<=0 ) {
printArray( A, j );
return ;
} for( int i=1 ; i<=n ; i++ ) {
A[j]=i;
PrintPartition( n-i , A ,j+1 );
} }
the first call of the function is : PrintPartition( n , A , 0 ) ;
View 3 Replies
View Related
Oct 23, 2014
I need to create a function that takes as an input a variable number of scalars and returns the biggest one. Just like std::max() does for 2 elements, but I need it for an undefined number of elements, can be 2, or 5, or 10 etc.. How to approach this?
What I need it for: I'm working with a bunch of vectors, maps, etc. and I need to find out which has the most elements. So I was thinking that I should end up with something like
int biggest = max(vector1.size(), vector2.size(), map1.size(), ...);
View 8 Replies
View Related
Mar 25, 2014
I have a class called items and stored in a vector as vector<items*> item.now I want to make a function to return the placement # that the item is stored at with a unsigned int. but if I don't find the item is there like a null unsigned int that can be returned.
unsigned int someFunc(vector<items*> item)
{
unsigned int size = item.size();
for (unsigned int i = 0; i < size; ++i)
{
if (item[i]->getItemName() == "sword")
{
return i;
}
}
//i need code here incase the item is not there
}
because the item might not be there and i would like to do a line if(unsigned int) do this code
View 19 Replies
View Related