Questions tagged [caesar-cipher]

A very simple cipher in which the letters of the alphabet are substituted by a different letter that have a fixed distance to the original letter.

A very simple cipher in which the letters of the alphabet are substituted by a different letter that have a fixed distance to the original letter.

Named after Julius Caesar, because he is said to have used it.

788 questions
21
votes
27 answers

Caesar Cipher Function in Python

I'm trying to create a simple Caesar Cipher function in Python that shifts letters based on input from the user and creates a final, new string at the end. The only problem is that the final cipher text shows only the last shifted character, not an…
user1063450
10
votes
4 answers

Looping for every character in a string in Python decoder ring

I'm trying to make a simple decoder ring in Python. Example: a=b, `b=c, c=d, etc. I want the script to take an encoded message and output the decoded message. For instance, I would input "ifmmp" and it would output "hello". I've been thinking I…
user1063543
  • 103
  • 1
  • 1
  • 4
9
votes
1 answer

malloc(): corrupted top size

I am working on a program that decrypts some line of text in a file. First, another source code I created asks for shift and some text. Source code encrypts the text and writes it into a file. Then, I try to decrypt the specified file using the…
Hakan Demir
  • 307
  • 2
  • 4
  • 12
7
votes
4 answers

Check for invalid input

I'm writing a program that will take a string as an input and check if the elements in it are valid or not. I want my input to only contain lower characters and periods, exclamation marks, and space and not an empty string. If the user enter an…
K.U
  • 293
  • 1
  • 4
  • 15
6
votes
20 answers

Caesar Cipher in Javascript

I am trying to write a program to solve the following problem in javascript (Written below this paragraph). I don't know why my code isn't working. Could someone help me? I'm new to javascript; this is a free code camp question. "A common modern…
unlucky
  • 115
  • 1
  • 1
  • 4
6
votes
7 answers

Java, How to implement a Shift Cipher (Caesar Cipher)

I want to implement a Caesar Cipher shift to increase each letter in a string by 3. I am receiving this error: possible loss of precision required char; found int Here is my code so far: import java.util.Scanner; import java.io.*; public class…
Sophia Ali
  • 301
  • 2
  • 6
  • 14
4
votes
1 answer

Simple Cipher - Ruby from Exercism

I am currently studying Ruby and have attempted Simple Cipher challenge. I am now studying the following solution and am trying to reverse engineer to understand the thought process behind of this solution. The following is the link for the…
user11836193
4
votes
3 answers

Caesar Cipher not running as expected

I'm playing around with Caesar Cipher and it doesn't seem to work. This is my code: class CaesarCipher { const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; protected $encrypt_sequence = array(); protected $decrypt_sequence = array(); …
Cojones
  • 2,930
  • 4
  • 29
  • 41
3
votes
3 answers

My Caesar cipher's output won't decrypt to the original string in Python, Windows

I have written a simple caesar cipher code to take a string and a positional shift argument i.e cipher to encrypt the string. However, I have realized some of the outputs won't decrypt correctly. For example: python .\caesar_cipher.py 'fortuna' 6771…
Berkay
  • 53
  • 9
3
votes
2 answers

JavaScript - Caesar Cipher

I know there have been a few posts about Caesar Ciphers in the past, which I have had a look at, but I haven't found an answer which has helped me to solve this kata, hence my post. The language is JavaScript. I've written 3 tests, 2 of which are…
IndigoDreams
  • 71
  • 1
  • 6
3
votes
3 answers

How can I solve a problem with caesar code in Python

I am trying to create a simple Caesar Code function that has to decipher a string given in input. Clear text = 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 Encrypted= D E F G H I J K L M N O P Q R S T U V W X Y Z A B C This is my code to…
Jenny
  • 259
  • 1
  • 2
  • 12
3
votes
2 answers

I am trying to perform a Caesar shift on the character z (ASCII 122). How do I give it "more room" to prevent it from overflowing past 127?

In the CS50 2019 Caesar assignment, I am supposed to perform Caesar shifts on characters by a given number of letters (key). To do this, I add the value of key to each letter, as such: for each character in plaintext: plaintext[character] +=…
yeojunjie
  • 41
  • 4
3
votes
2 answers

Caesar Cipher C# - How to work with uppercase and lowercase letters

I am creating a Caesar Cipher and I'm trying to figure out how to make it work with both uppercase and lowercase letters. For Example if I type in "Hello World" I want it to encrypt in the same format, "Ifmmp Xpsme. using System; namespace…
user11843114
3
votes
0 answers

Encrypting a word document changes the last byte

So I'm trying to encrypt / decrypt a word document using a Caesar cipher shift. My Caesar class works for images(.png) and (.txt) documents. However when I encrypt a word document (.docx) and decrypt that word document again the last byte get's…
Harry
  • 301
  • 1
  • 4
  • 9
3
votes
0 answers

Caesar cypher decoder in python

My task is to create a program that will decode a caesar cypher. I have done most of the work for this and it works fine going through each possible key and finding the new word. The problem appears when I am trying to check the words that are…
aidan
  • 85
  • 1
  • 2
  • 8
1
2 3
52 53