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
-3
votes
2 answers

Why do I get negative values for my ciphertext?

This is a problem set from CS50x. It's a Caesar cipher. It needs to shift all alphabetic letters (uppercase and lowercase) by the key which is input during run-time. It should preserve case, symbols, and numbers. I thought the code was correct, but…
-3
votes
1 answer

Python coding/ decoding cipher

I am trying to encode and then decode this function in python using cipher encryption. I wrote this function. how do I change this function so that it encodes both lower and uppercase letters? def encrypt(message, key): …
-3
votes
1 answer

if function error in Python 3

I am encountering issues in python with the if function in an exercise for my computer programming class in college, and am running into a problem with the 2nd if statement in the following program. It says that there is a syntax error: myPlaintext…
-3
votes
1 answer

Entering more than 1 shift amount in a program

Hi I'm having a tough time trying to incorporate more than 1 shift in my program. The goal is to assign a shift amount to each character like: statement = input("Enter string: ") shift = input("Enter shift amounts: ") For example, if statement =…
Chris
  • 35
  • 4
-3
votes
1 answer

C++ "Program has stopped working" - ROT-107 (Caesar cipher)

I have problem with my code. When I run this code, the correct answer appears. After a while i see an error showing that "program has stopped working" (0xC0000005). Have you got any idea why does the program not work properly? Everything seems to…
mar97
  • 21
  • 1
  • 4
-3
votes
1 answer

Getting Caesar Cipher to wrap around

I can get it to print the plaintext and and shift by the key value, but i'm a bit confused on how to get the letters to wrap around, and how to implement it into my code. Any suggestions would be appreciated. Thank you. #include #include…
ncubed
  • 41
  • 1
  • 8
-3
votes
1 answer

Strange char appears in the output

I'm trying to obfuscate word which is stored in string and my code sometimes works and sometimes doesn't. Here is my code: // main function int main(int argc, string argv[]) { string k, plaintext; int size, i = 0, key = 0; k = argv[1]; …
Ahmed Nabil
  • 41
  • 1
  • 2
  • 8
-3
votes
1 answer

Caesar Cipher using char * ? c++

So i am trying to use the Ceasar Cipher with char *'s, I've written a simple function out like this: char * Encrypt(char * s, int k) { char * c = s; for(int i = 0; i < strlen(s); i++) c[i] += k; return c; } that seems to look…
JeffCoderr
  • 283
  • 1
  • 4
  • 16
-3
votes
1 answer

Got stuck with Caesar.c

I am trying to run the program assignment caesar.c from the edx Introduction to programming. It requires a program able to encrypt a string with the Caesar encryption: therefore, the user has to enter a key (command-line); for example with a key of…
-3
votes
1 answer

'str' object is not callable in caesar encryptor

def encrypt_caesar(plaintext): s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" d = dict(map(s,s[3:]+ s[:3])) return ''.join(map(lambda l: d.get(l,l), plaintext.lower())) Tried to copy this code from Stanford lecture slide and run it but it gives 'str'…
leftunknown
  • 19
  • 1
  • 1
  • 6
-3
votes
1 answer

Encryption and Decryption within the alphabet - Python GCSE

I am currently trying to write a program, for school, in order to encrypt and decrypt a inputted message. I need the encrypted or decrypted message to only be in the alphabet no other symbols or keys, for example, with an inputted offset of 5 using…
-3
votes
1 answer

How to loop a numerical value in a range when reaching the end of the range

I am trying to create a basic encryption program that converts character values to numerical form, adds on a "key" and then converts them back to char form, thus encrypting the word. However I cannot figure out how to make the numerical value 90 or…
Ben
  • 3
  • 1
-3
votes
2 answers

Brute force Caesar Cipher

How do I make my program print the answers on separate lines + with what key the line corresponds to? def break_crypt(message): for key in range(1,27): for character in message: if character in string.uppercase: …
-3
votes
2 answers

Caesar cipher code in c

I have been working on this Caesar cipher code and this is what I have gotten so far and when the program runs nothing happens. #include #define MAX 80 main() { int shift, num; char ciph[MAX]; printf("Enter the message to be…
Isaiah
  • 1
  • 1
-3
votes
1 answer

I'm trying to create a Caeser cipher using python but i'm having some issues

def main(): text = input("Please enter text") translated = caesar(text) print(text,"ciphered is", translated) def caesar(text): key = int(input("Please enter key shift")) key = key % 26 translated = "" …
eliot
  • 11
  • 3