Hello Everyone Help needed, Has anyone implemented frequency analysis attack on caesar cipher in PHP and predicting the possible key for it. it should input the cipher text and predict the key using frequency analysis chart.

Member Avatar
Member Avatar
+0 forum 2

Python's double ended queue module makes Caesar's cipher easy.

Member Avatar
Member Avatar
+1 forum 1

Here's a small piece of code in python that may be helpful to those who like to play with substitution ciphers..... Say we have a text that is ciphered with simple [substitution cipher](http://en.wikipedia.org/wiki/Substitution_cipher), and say we know that the original text contained a certain phrase...but all we have now is a ciphered text and we don't know where is that phrase in the text. On the other hand, if we knew what part of ciphered text represents that certain phrase, that could be a great help for deciphering the text. Here's a simple code that can do that...feel free to …

Member Avatar
Member Avatar
+2 forum 1

Alright, so I have been coding a Ceasar Cipher in Java and I have the encrypting working, However, I cannot seem to find my problem decrypting. Here is the code, I thought just by revearsing all the operations it would decode it, but that doesnt seem to be the case. private static String Encrypt(String text, String key) { char[] cryptedText = new char[text.length()]; char[] textArray = new char[text.length()]; int[] keyArray = new int[key.length()]; for(int i = 0; i < text.length(); i++) { textArray[i] = text.charAt(i); } for(int i = 0; i < key.length(); i++) { keyArray[i] = key.charAt(i); char c …

Member Avatar
+0 forum 0

So, I have attached my code below. It worked fine , until I introduced the part to print out what's in the input file. After I did this, it says it's completed, but I doesn't copy the content in the output file. What should I change? Thanks a lot /*Program to read from a text file, encrypts the content with an offset FILE *file_input, *file_out; char input_name[20], output_name[20]; char content; int off_key; file_input = 0; while (file_input == 0) { printf("Please write the name of the file you want to open and get the input from: \n"); gets(input_name); file_input = …

Member Avatar
Member Avatar
+0 forum 3

I am kind of new creating the A1Z26 cipher generator. But this has a problem. Only the program generates the last two numbers. What's wrong? #include <iostream> #include <ostream> #include <string> using namespace std; int i; // Counter char str1[101]; // A string of characters for generator. string str2, str3; // Adds a string string str4; // Generated number. int nochar; // Number of characters. int a1z26() { for (int i = 0; i < nochar; i++) { if (str1[i] == 'a') { str2 = "1-"; } if (str1[i] == 'b') { str2 = "2-"; } if (str1[i] == 'c') …

Member Avatar
Member Avatar
+0 forum 1

So, I've been through a class in java so I know a little bit of what I'm doing... The assignment I have is to create a program that takes a string and converts the letters four away in the alphabet (ie: a becomes e and so forth). I've gotten most of my kinks worked out on my own, but you'll notice my encode and decode are different, I had it set up the way I do for my decode at first and switched to the method I am using in my encode in an attempt to fix my problem with …

Member Avatar
Member Avatar
+0 forum 4

I am doing code for CAESAR CIPHER. I need to built a histogram or frequency distribution for the output. I thought that finding out the frequency of the ASCII code, then print the frequency with * by using loop. But my code din't have array, can't do ++freq[c[i]]. I have no idea. Anyone can help? #include <stdio.h> #include <iostream.h> void encrypt(int shift); int main() { int shift; int decOrEnc; printf("Enter shift amount (1-25): "); scanf("%d", &shift); if (shift < 0) { printf("Bad Input."); return 0; } printf("Type 1 to Encrypt or 0 to Decrypt: "); scanf("%d", &decOrEnc); if (decOrEnc != …

Member Avatar
Member Avatar
+0 forum 2

Hello All, I am very new to C programming but i was working on cryptography for ipsec and am trying to write a code for implementing a simple code for a stream cipher which will take a 20 charecter long string and a 8 bit seed file and encrypt the text by performing a bit by bit xor operation on the string by generating a random number with same length as text using the seed string. I know i made some big mistakes but i dont see any compilation errors but i get a runtime error and it just prints …

Member Avatar
Member Avatar
+0 forum 2

hallo master .. I have a problem, how to make encryption and decryption using the Vigenere cipher in vb.net.? I hope someone can help me the problem. thank's before ..

Member Avatar
Member Avatar
+0 forum 2

http://en.wikipedia.org/wiki/Transposition_cipher#Columnar_transposition This is wiki site of what am trying to do #include <iostream> #include <cstring> #include <cmath> using namespace std; char GRID[3][80]; int MENU(int menu_choice); int REVIEW_OF_GRIDS_FIRST_79_CHARACTERS(int four); int main() { cout << " This is RAIL FENCE CIPHER\n" << endl; //----------------------------------------------------------------------------------------------------- //filing GRID with asterisks(*) char asterisk='*'; int k=-1; int i=0; while(k<2) { k++; while(i<80) { GRID[k][i] = asterisk; i++; } cout << "\n" ; i=0; } //----------------------------------------------------------------------------------------------------- //plaintext input into GRID char plaintext[0]; cout << "Enter message to encode:" << " NOTE:Asterisk(*) symbol is not allowed\n"; cin >> plaintext; int grid_row[5] = {0,1,2,1,99}; //012101210121 is pattern and 99 …

Member Avatar
Member Avatar
+0 forum 4

I need help with the caesar cipher homework assignment, I am stuck and I do not know where to go in this problem. THis is the decoder which moves all the letters back three, but I do not know what is missing.. import java.io.*; import java.util.Scanner; public class AssignmentSix { public static void main(String[] args) throws IOException { //open file FileReader inputFile = new FileReader("cipher.txt"); PrintWriter outputFile = new PrintWriter("plain.txt"); //loop the characters of input file while(inputFile.ready()){ char ch = (char) inputFile.read(); //decode the character char decodedChar = decode(ch); outputFile.print(decodedChar); } //close files outputFile.close(); inputFile.close(); } public static char decode …

Member Avatar
Member Avatar
+0 forum 4

#include <iostream> #include <cmath> #include <string> #include <cstdlib> #include <cstring> using namespace std; char Outputing(char shifted_letter); int found_match; int searching_alphabet; int main() { const char ORIGINAL_alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; //maybe const isn't necesery char alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; cout << "This program encrypts messages using Ceaser Cipher\n"; cout << "\n---------------------------------------------------------"; cout << "\n---------------------------------------------------------"; cout << "\nEnter plaintext or enter ABC to use alphabet as plaintext:\n"; cin >> alphabet; if (stricmp(alphabet,"abc") == 0) //comperes alphabet and ABC { cout << "\nAlphabet selected as plaintext\n"; cout << "\n---------------------------------------------------------"; cout << "\nEnter shift for alphabet:\n"; int shift_for_alphabet; cin >> shift_for_alphabet; cout << "Alphabet set:"; for (int i=0;i<26;i++) { alphabet[i] …

Member Avatar
Member Avatar
+0 forum 1

I have problem with this part of the code private char encryptChar(char c, int shift) { if (Character.isLetter(c)) return (char) ('A' + (c - 'A' + shift) % 26); else return c; } private String encryptMessage(String msg, int shift) { String result = ""; for (int i = 0; i < msg.length(); i++) result += encryptChar(msg.charAt(i), shift); return result; } and for encoding and decoding if (clientMsg.equals("ENCRYPT")) { System.out.println("Enkript"); opw.println("OK"); // send ok to client opw.flush(); // take the message from the server and send it back String text = br.readLine(); System.out.println(text); int shiftmsg = 26 - moving; opw.println(encryptMessage(text, shiftmsg)+"\n"); …

Member Avatar
Member Avatar
+0 forum 1

Although, I could easily state quite a few people will be bored with these, I couldn't find someone else with my problem. The code below runs, though doesn't decrypt. It gets to the first "Error: Unidentified Character" and ends. Any help great appreciated. [CODE]#include <iostream> #include <string> #include <array> #include <iomanip> #include <fstream> #include <cstdlib> //Defines the namespace using namespace std; int iteration = 0; int size = 375; //char *textReadIn; string userHold = "q"; //Ask the user to input the shift number. //loads the specified file. char inputFileName[50] = "task_1.txt"; //opening pointer ifstream inputFile; //decryption function which takes the …

Member Avatar
Member Avatar
+0 forum 2

hey guy's I'm relatively new to C++ and I've been asked to make a Caesar Cipher. I'm supposed to take an encrypted .txt file and output it's decryption. I've sort of got an idea of my flow as shown below but I'm confused as to how to transform capitals in the encrypted .txt file into lower case so I can process them normally. I know I have to use "tolower", does that mean I have to include the header for it as well? Here's my code so far, am I on the right track? I'm not seeing any errors right …

Member Avatar
Member Avatar
+0 forum 1

What is the best approach we can follow while trying to solve a cipher text without a key? I searched over web but was unable to find some good method.... Plz help guys...

Member Avatar
Member Avatar
+0 forum 3

i am trying to implement ceaser's cipher in the generic sense by rotating the digits by integer n.i am trying to find out the pairs of these from a file containing words. this what i've done so far, [CODE] from string import * d = dict() l = [] for i in range(ord('a'),ord('z')+1): d[i] = chr(i) def rotate_word(word,n): global l for i in range(0,len(word)): k = ord(word[i]) + n if k > ord('z'): k %= ord('z') elif k < ord('a'): k = k % ord('a') + ord('z') - ord('a') + 1 l.append(chr(k)) return "".join(l) wordlist = [] c_wordlist = [] …

Member Avatar
Member Avatar
+0 forum 11

Hi, I am working on a multiple layer encryption program for my school IT project. Right now the message runs through a Caesar cipher (which the user can select the shift of), it reverses the message and then it reverses the bits of each character, making various symbols come out. Now I want to add another encryption for it to run through. I want the user to enter a keyword into edtKode, so that the message is encrypted in such a way that it can only be decrypted if the end user also has that keyword. This will happen before …

Member Avatar
Member Avatar
+0 forum 8

can someone tell me how this program works? I'm trying to learning C++ by reading some examples, and this one is one of them. [CODE]#include <iostream> #include <string> using namespace std; class Vigenere { public: string key; Vigenere(string key) { for(int i = 0; i < key.size(); ++i) { if(key[i] >= 'A' && key[i] <= 'Z') this->key += key[i]; else if(key[i] >= 'a' && key[i] <= 'z') this->key += key[i] + 'A' - 'a'; } } string encrypt(string text) { string out; for(int i = 0, j = 0; i < text.length(); ++i) { char c = text[i]; if(c >= …

Member Avatar
Member Avatar
-1 forum 4

Hi I have been given a homework question asking to compare a made up Cipher along with know Ciphers, the cipher i have been given is called name cipher it takes the last letter of your first and second name and gives them a value and then adds them together an example would be Mac Apple = CE 3+5 = CE8. The algorithm for encrypting a plain text character at position n is simply to perform the XOR operation on the text with the key character using ^. So an example C ^ C O ^ E N ^ 8 …

Member Avatar
Member Avatar
+0 forum 3

Okay the text on my input file is Wxmv_bpm_xwl_jig_lwwza,_PIT._Q'u_awzzg,_Lidm._Q'u_inziql_Q_kiv'b_lw_bpib. Here's My code but for some reason I can't get my program to convert the message to my output.txt file. Can someone please help thanks [CODE] #include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main() { string str; int shift; char inChar; char outChar; char c; ifstream inputFile("INPUT.txt");// Opening INPUT.txt file ofstream outputFile("OUTPUT.txt");// Opening OUTPUT.txt file if(!inputFile){// Checking for errors or existence of INPUT.txt file cout << "Error...file INPUT.txt doesnt exist.\n"; exit(1); } if(!outputFile){// Checking for errors or existence of OUTPUT.txt file cout << "Error...file OUTPUT.txt doesnt exist.\n"; exit(1); …

Member Avatar
Member Avatar
+0 forum 9

Hey all, I'm relatively new to python, just started learning it about a week ago. I've been working on making some small scripts to make learning easier for me. This is a cypher script I've been working on that is based off of the order of letters used on a qwerty keyboard. For instance, 'k' would typed be using the middle finger on the right hand (the sixth finger in sequence), and the second in alphabetic sequence, thus 'k' would be 62 (sixth finger second letter). Then the program adds 80 to the final integer and uses the chr() command …

Member Avatar
Member Avatar
+0 forum 3

I'm attempting to create a one line Caesar cipher decryption program in python and i'm afraid i've come to the end of my knowledge and well past it. this is the closest working code i've got: [code]def test3(): print("The decrypted text is: "+"".join(map(lambda x: chr(ord(x)+y),x)))[/code] as you can see it requires me to define x and y (the input text and the shift amount respectively) before hand. this wont do, next i tried this (and several variations of) [code]def test4(): print("The decrypted text is: "+"".join(map(lambda x=input("text: "),y=eval(input("shift: ")): chr(ord(x)+y),x)))[/code] but x is undefined globally the function should run as follows: …

Member Avatar
Member Avatar
+0 forum 5

Hi guys, I'm looking for AES equivalent inverse cipher...Has any one worked on it.. I need a c code for it ... please it's really very urgent..

Member Avatar
Member Avatar
+0 forum 9

Hey all, I'm relatively new to python, just started learning it about a week ago. I've been working on making some small scripts to make learning easier for me. This is a cypher script I've been working on that is based off of the order of letters used on a qwerty keyboard. For instance, 'k' would typed be using the middle finger on the right hand (the sixth finger in sequence), and the second in alphabetic sequence, thus 'k' would be 62 (sixth finger second letter). Then the program adds 80 to the final integer and uses the chr() command …

Member Avatar
Member Avatar
+0 forum 1

Hey guys, my name is Ross. Im new to programming and i need some help with assembler. I have a menu with a number of options that the user can do. 1. The first one is the user must input a string of characters up to the limit of 25 and then give a error message. i can get the menu done with the input but i cant seem to get the error message. 2. The second option is to display the string inputted by the user, which i have done, so no problem there. 3. I need to display …

Member Avatar
+0 forum 0

Hello! I've started programming C++ a week ago, so I cannot solve my problems easily. I've started a small project for learning classes, it's about encryption and stuff. I don't really get pointers, although I've read some about them. My problem is that when I use the cipher, it replaces all characters in the string with an 'a' or an 'A'. Thus, the output of test.cpp is the following LeVEnte A nEVeM AaAAaaa A aAAaA Press any key to continue . . . Also, I'd like to learn how to write beatiful code, so if I do something the ugly …

Member Avatar
Member Avatar
+0 forum 8

Hi, I'm brand new to Python and am completely clueless in this assignment. This is the 3rd assignment, but the first without hints on how to import, etc.. The objective of this assignment was to decode a file we are supposed to use the python hw.py < code.txt command with. This confused me right from the start, I understand that it uses the file as the input, but I dont understand how to do that code sided. We are also supposed to be shifting using letter frequencies, which are in percentages, also have not yet been discussed in class. Any …

Member Avatar
Member Avatar
-1 forum 3

The End.