C++ :: How To Encrypt TXT Document Using Caesar Encryption

Mar 1, 2013

so i need to encrypt a txt document using Caesar encryption. however i don't know how to open a txt and shift the keys into a new txt. the program has to ask the user for the number it should shift. Using arrays, if else. i also need to make a menu so i am using switch.

View 4 Replies


ADVERTISEMENT

C++ :: Caesar Cipher With 2D Array

Dec 11, 2013

I am making a simple caesar cypher with a 2D array. I have to make a function for the key shift so

key=5
ABCDEFGHIJKLMNOPQRSTUVWXYZ
FGHJKL...ABCDE

Function Name: Key_Array
This function uses the random key value to make a key array
Passed: value = random key value
Returns: alphabet = rearranged alphabet

[Code] .....

I am having trouble outputting the rearranged alphabet to the screen also.

View 1 Replies View Related

C++ :: Caesar Cipher Reading Text

Aug 1, 2013

I get the error of not declaring "text" "exit" but I how do I declared those variables, even if they cause problem to file... How can I output the decipher file in a new text...?

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <math.h>

[Code] ....

View 6 Replies View Related

C/C++ :: Caesar Cipher Not Decrypting Text Right

Mar 29, 2015

I have managed to print out the encrypted text from the console, however it doesnt decrypt correctly and isn't returning the correct key. I can't seem to find the error that is causing the decrypted text from printing correctly. When I try to decrypt the text it changes it completely as well.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "rotUtils.h"
bool solved( char decodearr[], char dictarr[][30], int size1, int size2){
char* compared;
bool result = false;
for(int j = 0; j < size2; j++){

[code]....

View 3 Replies View Related

C :: Write A Code About Caesar Cipher Shift And Using ASCII With It

Dec 5, 2014

I am struggling to write a code about caesar cipher shift and using ascii code with it. For example letter b should be replaced with the letter c and using the ascii code it should be from 98 to 99 and so on..

View 1 Replies View Related

C++ :: Deciphering Unknown Shifted Caesar Cipher Text File

May 25, 2014

The assignment is to open an encrypted file, count the occurrence of each alphabetic character in the file. find the highest occurring letter and use that to find the shift, then apply the sift to the file in order to decipher and then print out the deciphered txt.

#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main(){
string word;
ifstream txt;
int arr[26] = { 0 };

[Code] ....

View 5 Replies View Related

C/C++ :: How To Encrypt The Password To Be Inputted

Sep 14, 2014

#include<stdio.h>
#include<conio.h>
#include<string.h>
char str1[20], str2[20]="kent";
main() {
printf("Enter your Username: ");
scanf("%s",str1);

[Code] ....

View 1 Replies View Related

C :: Program Attempts To Encrypt A File Using XOR Operator?

Mar 18, 2013

My program attempts to encrypt a file using XOR operator. However, when I attempt to encrypt a file, it says "Error in reading file", (a printf function I set up if the program could not read the file, obviously). The problem is that I don't know what's causing this. Instead of encrypting the file, it just deletes all the characters in it, so I put in a fprintf to put place some text into the file. Here is the code:

Code:

#include<stdio.h>
#include<string.h>
int encryptd(FILE *);
int main(void)
{
FILE *fileptr;
int recode;
char fname[25];

[Code]...

View 7 Replies View Related

C :: Program In Which Computer Will Read Txt File And Encrypt It

Jan 1, 2014

I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.

One two three four five
(newline) Six seven eight

The computer will stop reading after 'five'. I assume that is because I use fgets.

View 4 Replies View Related

C++ :: How To Make Own Binary Trees And Encrypt Messages

Jun 8, 2013

I'm having some trouble with my binary tree for school. It is a data structures class so we are working on learning how to make our own binary trees and encrypt messages. Everything so far is working, except for my delete node function. I'm trying to do it recursively. Parts of my code.

/******** Node *********/
struct node {
char data;
node* right;
node* left;
};
/******** Binary Tree Class *********/
class BinaryTree

[Code]...

View 5 Replies View Related

C++ :: Encrypt Char Array With Binary Data

Apr 14, 2013

I am trying to encrypt a char Array with binary data.

I think I understand the basic of Encryption / Decryption but I fail to see how to implement something.

I am trying to have a "key" that needs entered so the data can become readable executable. The program I am encrypting is a small console window with a message with the text "A secret message from your friend" (Not that it matters).

I have the binary data witch I can copy and what not. But how go about Encryption and then decrypt it and not destroying the data.

View 6 Replies View Related

Visual C++ :: Create A Function Using Rot To Encrypt Strings

Sep 30, 2013

I need to create a function using rot to encrypt certain strings the function begins like this

#include "encrypt.h"
std::string encrypt (std::string text, int rot) {
for (int i
and ends like this
return NULL;
}

dont need to write the string encrypted and dont need to crate a decrypt function.

View 4 Replies View Related

C :: Encrypt Message Within BMP File - Incorrect Struct Size

Feb 9, 2015

I'd wrote a program to encrypt a message within a bmp file using my own structs and all for everything (yes, call me a ........head) The program works but for some weird ........ing reason I was forced to subtract 2 bytes from the header size to get the correct value. I've narrowed down the issue to my BmpFileHeader struct.

Here's a short program that demonstrates the issue:

Code:
#include <stdio.h>
#include <stdlib.h>

#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define LONG signed int

[Code] .....

Tried with both gcc and TinyCC and got the same result so it doesent seem to be a compiler bug. Microsoft's structures though are giving the correct size, even though they have the exact same definition.

Microsoft's defines:

Code:
// windef.h
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WORD;

[Code] .....

View 5 Replies View Related

C++ :: Gather Input From User And Encrypt / Decrypt Those Characters?

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

C++ :: Using XOR Encryption?

May 31, 2012

I am currently using a byte encryption in C# which gets decrypted in my C++ client.

It is XOR, but I can't get it to work. Is there anything that Im doing wrong?

I already wrote the C++ XOR in C#, which look pretty much the same.

C#

Code:

public byte[] XOR(byte[] strng, byte[] key) {
int string_len = strng.Length;
int key_length = key.Length;
int i, position;
for (i = 0; i < string_len; i++) {
position = i % key_length;

[code]....

View 14 Replies View Related

C :: Create 2 Int For FOR Loop To Do Encryption

Jun 15, 2014

what i think i need to create 2 int for the FOR loop to do the encryption but how am i to do it meaning the actual encryption itself what is that i check with?Also i think i need more than just the #include <stdio.h> library due to the file functions that i will need or is C having them built in? Also what is that about the program doing all this from DOS?

Create 2 programs with the names encrypt and decrypt that will encrypt and decrypt files respectively.The encryption and decryption will be done through a command line of DOS and the program should be as follows: encrypt file1 file2 key and decrypt file1 file2 key

Where:
file1 is the source file
file2 is the destination file
key is the word with which we encrypt/decrypt file1

So when the user executes the command encrypt f1 f2 sunnyday the program will create a file with the name f2 which will have the contents of f1 encrypted with the key sunnyday.When the user executes the command decrypt f1 f2 sunnyday the program will create a file with the name f2 which will have the contents of f1 decrypted with the key sunnyday.

If the user gives a wrong key the program will continue to decrypt file1 but since the key is wrong the results will be unexpected.Finally the program must print the corresponding error messages in case of errors for example (There is no file 1).The program is expected to work corectly with not only plain text files but executable (exe) files etc.Also The program must be fully commented.

Note: The way the encryption will work is yours to choose but it is recommended that you encrypt every letter of the file with every letter of the key with the (start to finish and begin) technique meaning that if the key has 8 letters then the first leeter of the file will be encrypted with the first letter of the key, the second letter of the file with the second of the key, ..., the ninth letter of the source file with the first letter of the key, the tenth letter of the source file with the second letter of the key etc.

View 3 Replies View Related

C++ :: AES - Encryption / Decryption With OpenSSL

Aug 9, 2013

I just want to test AES from openSSL with this 3 modes: with 128,192 and 256 key length but my decrypted text is different from my input and I dont know why. Also, when I pass a huge inputs length (lets say 1024 bytes) my program shows `core dumped`... My input is always the same but it doesnt matter, at least for now. Heres the code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/aes.h>

int main(int argc, char **argv){

[Code] .....

View 1 Replies View Related

C++ :: Encryption Of File (Docx / PDF)

Apr 28, 2013

I have been assigned a project by my teacher to make a program in c++ which will be able to encrypt a text file, a .docx file or a pdf document !!! Encrypting a text file is easy i have already done that but how do i encrypt a docx file or a pdf file ???

View 2 Replies View Related

C/C++ :: Encryption And Decryption Program?

Mar 19, 2015

this program on how to make a encryption and decryption program of a txt file

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

[Code].....

View 1 Replies View Related

C/C++ :: Encryption Program Error

Aug 5, 2014

Back again with a random bug that I can't seem to track down. My error is in my main.cpp file. I get a C2248 error on line 54, there I'm doing:

t.makeEmpty(t.root)

I know why, because it's a private member...but it should have access in so far as everything is concerned. I double checked my makeEmpty code and it's good to go so far as I can tell. I can't quite iron out where the disconnect is.

V/R
Brad
main.cpp
#include <iostream>
#include <string>

[Code].....

View 4 Replies View Related

C/C++ :: AES Encryption / Decryption Of Text

Oct 29, 2013

We need an AES Encryption/Decryption program in C for college lab (Educational) purpose . So we cannot use any "aes.h" file for this . We need a C program which simulate the purpose of AES

Input : Text (e.g: Anes P.A)
key (e.g:123op)

Output : Cipher Text using AES

I look this functionality done in a website : [URL] ....

Attached Images : AES.jpg (36.4 KB)

View 1 Replies View Related

C++ :: Basic Encryption And Decryption Program

Sep 29, 2013

I am having trouble with an assignment. The assignment consists of a basic encryption and decryption program already written for me, I just have to write the encryption function. What we have to get the program to do is enter an integer and a text, and get the program to increment each letter in the text by the integer given. I did this by using a for loop and incrementing each value in the string by the integer.

However, I still can't get it to decrypt and I need the program to work with only a-z letters (if I increment each letter by 3 and I have the letter Z, it should go to Z+3 = C).

I attached the description of the attachment and below are the codes: The first file does not need to be edited.

Code:
/*******************Programming Assignment 1***************/
/****************Caesar's substitution cipher**************/
/*****************YOU MUST NOT EDIT THIS FILE**************/
/****Substitute alphabets in a string using rotation key***/
/****Leave all other characters unchanged******************/
/****Confirm correct encryption by decrypting**************/

[Code] ......

View 1 Replies View Related

C :: Encryption Of Data To Be Sent From Mobile To Server

Mar 8, 2013

I just started to work on a project which is 'Body Area Network'.

What I need to do is to take data from body with some sensor nodes and send it to mobile which would further send the data to a remote server, and I need to add some security (encryption/decryption) on the data.

So I want to know how to send data from mobile after encrypting it to the server and then decrypt it back(on server side).

View 6 Replies View Related

C# :: Des Encryption Produces Wrong Output

Feb 14, 2012

I have the following function:

Code:
public static void Des(byte[] key, byte[] inBuf, byte[] outBuf) {
if (key.Length != 8 || inBuf.Length != 8 || outBuf.Length != 8) {
throw new Exception("Des: Buffer or key length incorrect.");
}

DESCryptoServiceProvider des = new DESCryptoServiceProvider();

[Code] ....

I do not get the expected output of

Code: { 0x88, 0xBF, 0x0D, 0xB6, 0xD7, 0x0D, 0xEE, 0x56 }

instead I get

Code: { 0xC6, 0x61, 0x8D, 0x63, 0x0B, 0x39, 0x31, 0xB0 } am I doing something wrong?

I've even tried reversing the byte order of the test data, and I don't get the right result. I've tested the same data using C++ with CryptoPP on Linux, and I get the expected result, but I'm porting this code to run on .Net, and this is my main stoppage in the process at the moment.

View 5 Replies View Related

C++ :: Basic Encryption / Decryption - While Loop

Jul 14, 2013

while(!in.eof()) {
in >> ch;
char d = int(ch) + 10;
out << d;

[Code] ....

The first while loop would be to encrypt it, and the second would decrypt it, the decrypting is not giving the original content. For example:

in = Hello
encrypt...
decrypt...
out = Hellooo

View 2 Replies View Related

C++ :: Text Encryption And Decryption Using MD5 Algorithm

Sep 6, 2014

How to do encrypt and decrypt the text by using md5 algorithm without using the any library? Only implement in c++ program.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved