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

Caesar cipher: How to take shift as input?

How can I make each letter in the message to be encoded by replacing it with the letter k positions further in the alphabet?. For example, if k=3, “a” is replaced by “d”, “b” is replaced by “e”, and so on. The alphabet wraps around. “w” is replaced…
mayna
  • 75
  • 1
  • 1
  • 4
2
votes
4 answers

Working in Simple Cesar Cipher in C

I'm working in a program for university and they use a problem like the typical Cesar Cipher. It's more like a functional program and needs to be the most basic possible. The program will receive a number from the user from 65 to 90 and for example…
2
votes
3 answers

Encrypting a string that contains unicode results in unrecognized characters

I'm trying to encrypt a string in C#: static public string Encrypt(char[] a) { for (int i = 0; i < a.Length; i++) { a[i] -= (char)(i + 1); if (a[i] < '!') { a[i] += (char)(i + 20); } } …
Adi Aji
  • 31
  • 5
2
votes
2 answers

why does my python code not encrypt or decrypt my message

For some reason when I run the code at the end it just displays the message without encrypting or decrypting it im really confused please do not hate on me if this is really obvious I am very new to python and barely know the basics #declare…
user4953240
2
votes
2 answers

Caesar cipher returning only first translated letter?

Why is my encrypt function only returning the first translated letter? (I've cut out the decrypt and brute force -function). The issue is probably a small one but I'm new to this and I've been staring at it too long for anything to pop into my…
2
votes
2 answers

Caesar Cipher - Wrong Output

The problem is: Your program needs to decode an encrypted text file called "encrypted.txt". The person who wrote it used a cipher specified in "key.txt". This key file would look similar to the following: A B B C C D D E E F F …
Maddie
  • 41
  • 3
2
votes
1 answer

Caesar shift cypher

I'm working on a simple Caesar Cipher in python using chr() and ord() Here's my code: key = 13 newString = '' if mode == 'decrypt': key = -key for c in message: newString += chr(ord(c) + key) print newString But something funny…
Mickey
  • 117
  • 1
  • 10
2
votes
2 answers

Caesar Cipher: Correct encryption but output missing spaces and punctuations

I have been working on this since yesterday and after much struggle have managed to encrypt the message successfully. However, my output is missing spaces. As I understand it, the reason this is happening is because I'm using isalpha(), isupper()…
1
vote
0 answers

Image encryption and decryption using AES algorithm

I'm creating Image encryption and decryption using AES algorithm. All of my code runs well and image is being selected for upload and encryption process runs but following error appears Incorrect AES key length (64 bytes) Screenshot attachedenter…
1
vote
1 answer

How to create a function type boolean that checks to see if the command line argument is in fact a digit?

I am currently taking cs50 introduction into computer science. I'm trying to create a type bool function with argument string named only_digits that will check to see if the command line argument that the user inputs is in fact a digit. I don't…
1
vote
1 answer

Caesar cipher with JavaScript

I've checked different websites with different code variations, but couldn't find the appropriate answer. I need to create 2 functions where : -1st function will cipher the given message with key, which is string; e.g. If Message=hello and…
fara_ngis
  • 33
  • 2
1
vote
1 answer

My reverse caesar shift assignment works on vscode but not when I submit it to gradescope

I have a homework assignment where I have to make a function that is used to reverse the effects of a caesar shift on a string. For example, if the string after the shift is "fghij", and the shift value is 5, the function should yield "abcde." This…
user1529
  • 13
  • 3
1
vote
1 answer

C# Simple encrypt/decrypt algorithm

I was working on straightforward encryption and got stuck on one of its rules. The rules are, Encryption work by adding 5 to each character. Only encrypt a-z and A-Z, all other characters will add to the encrypted string as it is. If the character…
0xdw
  • 3,755
  • 2
  • 25
  • 40
1
vote
2 answers

incompatible pointer to integer conversion in caesar cipher

I'm trying to create a "Caesar cipher". I was hoping my code was finally complete however I ran into some errors while trying to run the code. I'm a complete beginner with C so I suspect I'm just not correctly calling a function BUT there will…
dariocodes
  • 133
  • 1
  • 1
  • 7
1
vote
2 answers

C compiling Error: non-void function does not return a value in all control paths - CS50

I'm doing the CS50 course in C and am working on the problem set from week 2. I'm an absolute beginner so there's probably a lot wrong with my code. For now, I'm trying to create a function that checks if the user has correctly used the command line…
dariocodes
  • 133
  • 1
  • 1
  • 7