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
-1
votes
1 answer

CS50 CAESAR - Different output depending on position of statement, but I don't understand why

In the below code, I get different output depending on where I place the 'Printf("Ciphertext: )' statement, and I cannot understand why. Could anyone please point out what I am missing? Below you can find the code, and the output (variable piece in…
Zegher V
  • 117
  • 7
-1
votes
1 answer

NameErorr name 'filename' not defined after returning 'filename' from another function

Hi I was writing a code for a simple Caesar cipher decrypting program with python 3 and I got this error message when I was trying to run the program. Here's the code and I've got some description of the situation I'm having after the code. def…
yerim2
  • 83
  • 10
-1
votes
2 answers

Caesar cipher for numbers in C

I want to make a Caesar cipher for numbers. (Add 3 to all digits) Input: 52 Output:85 Input:954 Output:287 Input: -10457 Output:-43780 I'll be very glad if someone helps me with this. I tried this but when I input the number less than 5 digits it…
cl-creator
  • 25
  • 6
-1
votes
1 answer

Why can't I print space while encrypting using Caesar cipher?

I am trying to write a C program that encrypts or decrypts a message using the Caesar cipher method. The user can enter the message with spaces, but my C program prints some other character (like an [], alpha symbol, or an alphabets sometimes). Can…
alvin lal
  • 138
  • 4
  • 10
-1
votes
1 answer

How to write a Ceaser Cipher Python

I am not sure how to start writing the program. input = input("Input the text you would like encrypted") def cipher_text(letter_code): for i in input: number_code = ord(i) + 3 letter_code = chr(number_code) …
Brian Mason
  • 13
  • 1
  • 8
-1
votes
2 answers

How do I define an array of Strings using a method?

I wrote a method to encrypt messages (using CaesarCipher) and I want to use that method to encrypt one message with all possible 26 keys. So I want to iterate over each String array to define it. public String[] getMessage(String message) { …
-1
votes
1 answer

C Caesar Cipher Function Call Not Behaving as Expected

I am trying to build a program that will do a simple caesar cipher on a text file with single strings with no spaces on each line. For some reason, my cipher function is not shifting text and I am cutting off the strings at various lengths of…
efuddy
  • 105
  • 1
  • 3
  • 11
-1
votes
1 answer

I have written this ceaser cipher program in c,but everytime i run it it crashes

I have written this caesar cipher program in c language,it runs fine until I provide the integer value for key but after that it crashes. can anyone please correct this code? #include #include #include char…
-1
votes
1 answer

Caesar Harvard CS50X

This is a very early version of pset2, caesar. I have figured out how to encrypt, but have found difficulties in figuring out how to convert the ASCII code to the actual letter. Can anyone help? for (i = 0, n = strlen(plain); i < n; i++) { if…
-1
votes
1 answer

Caesar cipher outputs blank line

I am doing a problem set from the CS50 course and we have to implement Caesar's cipher. The following code works only with numbers (they remain the same as intended), when you put in a character, however, nothing is output. What's wrong? #include…
Adam Grey
  • 95
  • 9
-1
votes
1 answer

Could someone explain this code for me please

I found this Caesar cipher encryption code on the web and I'm trying to understand how it works #include int main() { char message[100], ch; int i, key; printf("Enter a message to encrypt: "); gets(message); printf("Enter key:…
user8408288
  • 64
  • 1
  • 7
-1
votes
2 answers

What does return(char)((((ch + key) - offset) % 26) + offset) code do?

So I was looking up C# Caesar ciphers online and I found this website: https://www.programmingalgorithms.com/algorithm/caesar-cipher I looked through and generally the code made sense to me until this part: char offset = char.IsUpper(ch) ? 'A' :…
ParadAUX
  • 53
  • 1
  • 8
-1
votes
1 answer

ROT-13 using the entire printable ASCII Character Set C++

I am trying to create a code that will use the entire printable ASCII Character set. My problem is that when it comes to characters that will be a number higher than 126 they print as '?', except for 'r', which prints correctly. Why does my code…
Lacey
  • 11
  • 1
-1
votes
1 answer

printing Caesar cipher at once

def en(password,shift): result = "" for i in password: result += chr(ord(i)+ shift) return result def de(password,shift): result = "" for i in password: result += chr(ord(i) - shift) return…
coneass
  • 13
  • 1
-1
votes
1 answer

How to check if user inputs an integer (Python)

I might be constantly asking about my project with Python (since I have 3 help requests already up) but I just want to make this the best it can be. This time I want to make an if statement to check if the user inputs an integer (number) instead of…
Kieran
  • 41
  • 1
  • 2
  • 9