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

Why does this code always print false even if the key is a-z and 26 letters. Also how can I find repeated characters in the string?

public static boolean EncrptionKey(String Key) { Scanner input = new Scanner(System.in); Key = input.next(); if(Key.matches("^[a-zA-Z]") && Key.length()==26) { System.out.println("True"); …
Rush
  • 1
-1
votes
2 answers

Why is this python code printing one letter at a time?

def encrypt(): msg = input("Enter the message you would like to encrypt: ").strip() print() key = int(input("Enter key to encrypt, a number 0-25: ")) encryptedMessage = "" for ch in msg: if ord(ch) == 32: …
-1
votes
2 answers

Segmentation Error in c, week 2 caesar, cs50x harvard course

So I'm on week 2 of the harvard cs50 online course (2021x version). We're supposed to write a program that encrypts a text, moving every letters ASCII code by a certain amount, decided by the user through the command line. Here is the full problem.…
charlie
  • 3
  • 1
-1
votes
2 answers

Is it possible to calculate with ASCII numbers that are temporarily bigger than 127?

First of all, im new to coding and I thought sometime about the problem and I tried to google it. I already have a workaround I just want to know if it is possible in another way. Im taking the cs50 course and I should write an encryption…
TR3478
  • 25
  • 6
-1
votes
1 answer

CS50 Pset 2 Caesar --- Validating the key

Trying to get this code to reject 20x (and other similar inputs). It rejects xyz and x2 however not 20x. Seems there's an issue with my loop... Any advice? #include #include #include #include #include…
-1
votes
2 answers

Decryption of cypher in C

I am making a Caesar Library in C. The library source code contains the function below, which returns the encrypted equivalent of a given character: char cypher_charac(char charac, int key) { if (islower(charac)) { charac = 'a' +…
GNSH
  • 1
  • 1
-1
votes
1 answer

In Assembly How do I get the next corresponding letter in the alphabet and opposite of the previous characters capitalization?

I am trying to reverse the string but simultaneously change each character to its next corresponding letter in the alphabet but must be the opposite capitalization as well. For instance, when the user enters "Test" the output should be "UTFu". How…
-1
votes
3 answers

Caesar Cipher Wrapping

I'm trying to make a caesar cipher, but I'm not sure how to wrap it. Apart from the wrapping, it is all correct. I also want to keep special characters as it is, without changing them. Code below: int main() { char message[100], ch; int i,…
John DOe
  • 1
  • 1
-1
votes
1 answer

If -else if- else statement not working as expected

I am using 'Apple Clang' on MacOSX. The below code is a shift cipher that uses one of 8 different shift values depending on the position of the char in a string (which is the message). Going by the rules it should encode 'ABC ' (with the int array d…
user13863346
  • 327
  • 2
  • 11
-1
votes
1 answer

Weird characters randomly appearing when converting int arr to string in C (with valid ASCII)

This is a simple Caesar cipher implementation in C. I take a pin, make a key from it, take a message, shift the ASCII value w.r.t the key, and output the hex value of each character in hex. Upon using (as it appeared to me) any key , for the some…
A P Jo
  • 446
  • 1
  • 4
  • 15
-1
votes
1 answer

How to figure out the cypher knowing some inputs and outputs

So I found a little problem on the Internet: given only 3 inputs and corresponding outputs, one need to figure out the cypher or the encoding algorithm that was used. The inputs/outputs are: "get" -> "2069" "more" -> "5191716" "insight" ->…
Ilya Maier
  • 475
  • 3
  • 12
-1
votes
1 answer

Caesar cipher to return message decrypted in 26 ways - Python

I'm a beginner and working on a code that should return a word/sentence decrypted in 26 ways (using all steps i the alphabet) on Python. I was able to create a standard code to decrypt word/sentence when the key is given, but I can not figure out…
Jnathan
  • 3
  • 2
-1
votes
1 answer

New cipher problem, how to decode given enciphered code?

While I am trying to solve Caesar cipher, I faced few problems. #enciphered message = 'I wtvp olel decfnefcpd lyo lwrzctesxd' plain = 'abcdefghijklmnopqrstuvwxyz' cipher = 'lmnopqrstuvwxyzabcdefghijk' cipher_text = input('Enter enciphered message:…
-1
votes
1 answer

Is it possible to store ASCII control characters in a string?

I'm working on a Caesar Shift Cipher for my school assignment and am having trouble implementing the ASCII wrap around functionality. The problem is when the shift occurs outsize of the ASCII range [0, 127]. I currently % the result of the shift by…
CobraPi
  • 372
  • 2
  • 9
-1
votes
1 answer

Python ceasar cipher

You will be implementing a shift-cypher. This type of code shifts every letter by a set amount. Instructions: Complete the encode method so that it returns the encoded message. Complete the decode method so that it returns the decoded message. In…
Dankharl
  • 57
  • 6