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

Java Caesar Cipher

In this Caesar cipher i am obtaining the incorrect output for capital letters. The code is as follows: public class CaesarCipherCaseSensitive { public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz"; public static String encrypt(String…
RaymondRay
  • 39
  • 1
3
votes
1 answer

How to perform a Caesar Cipher with multiple shifts

For example, if I were to apply 4 shifts to "breakzone" than it would be intended to be like: "b" would be shifted by 2 characters "r" would be shifted by 3 characters "e" would be shifted by 4 characters "a" would be shifted by 5 characters and…
Chris
  • 35
  • 4
3
votes
2 answers

Javascript ROT13 Function working only partially

My ROT13 JS function works fine for the most part, but some of the characters just come out wrong, e.g. HELLO comes back with U,R,Y,Y,\. Could somebody please explain to me what I am doing wrong? P.s I'm doing the freeCodeCamp Caesars Cipher…
user7781821
3
votes
2 answers

Function That Receives and Rotates Character - Caesar Cipher

I'm trying to create a function rotate_character(char, rot) that receives a character, "char" (a string with a length of 1), and an integer "rot". The function should return a new string with a length of 1, which is the result of rotating char by…
HappyHands31
  • 4,001
  • 17
  • 59
  • 109
3
votes
1 answer

Caesar Cipher Encryption giving wrong output

Whenever I input string such as Dizzy with key 10 for example the output is partially wrong. I am having something like this ===>ns��� while I should have nsjji. Serial.print("KEY: "); Serial.println(k); if ((choice[0]=='e') || (choice[0]=='E')){ …
user3346439
  • 113
  • 1
  • 1
  • 9
3
votes
4 answers

Creating A Caesar Cipher in Ruby, getting an error

I am attempting to create a Caesar Cipher in Ruby for my computer science class. My friend was able to create part of the code: def cipher(word, n) new_word = "" word.each_char do |i| n.times do if(i == "z") i = "a" …
3
votes
2 answers

Caesar's cipher - where am I going wrong?

I've written this simple program including a method for encoding a message (Caesar's cipher)... doesn't work though, and I think it has something to do with my if condition for letters that become offset past 'Z' (and thus reset to the beginning of…
ktouchie
  • 371
  • 1
  • 3
  • 9
3
votes
3 answers

Caesar Cipher Shift (using alphabet array)

I am currently writing a Caesar Cipher program in C# for my assignment and I am having a problem. I am approaching this task using an array where I store the whole alphabet and I declare a shift variable which is defined by character index in the…
terasss2
  • 75
  • 1
  • 1
  • 6
3
votes
2 answers

decipher( s ) python

Decipher( S ) will be given a string of English text shifted by some amount. Then, decipher should return, to the best of its ability, the original English string, which will be some rotation (possibly 0) of the input S. This means I have to try…
Benjamin Brooks
  • 195
  • 3
  • 6
  • 14
3
votes
2 answers

Encrypt Caesar VB.net

I want to encrypt using caesar cipher with VB.net. I am successful when I input 'ABC' the result is 'def', but when I input 'XYZ' the result is still 'xyz'. When I input 'XYZ' the result should be 'abc'. Can you guys help me please? Source…
PX1
  • 31
  • 3
2
votes
1 answer

How can I fix my Caesar Cipher implementation in assembly language to read multi-digit keys?

My code implements the Caesar Cipher, it asks the user the name of the input file which contains the string i want to be encrypted/decrypted, the name of the output file and the key/cipher, my problem is that it is only reading the first number of…
Lucas
  • 23
  • 4
2
votes
2 answers

perofrming caesarcipher for a string using shift

from string import ascii_lowercase as alphabet1 from string import ascii_uppercase as alphabet2 import letter as letter def cipher(user_input, shift): cipher1 = {char: alphabet1[(i + shift) % 26] for i, char in enumerate(alphabet1)} …
Jyoti
  • 31
  • 4
2
votes
2 answers

A decipher which only deciphers every second letter

So I'm making a function to decipher rot13 or a variant of caesar's cipher. But for some reason it only deciphers every second letter... I have no clue what to change or do. Thanks function rot13(str) { let regexp = /\w/gi; let obj = { "A":…
Api.
  • 25
  • 4
2
votes
2 answers

Caesar Cipher in Python: remove spaces in a list

I'm working on a Caesar Cypher project. I take the user's input, turn it into a list, take out spaces, and then encrypt the letters. My question is: How do I re-add these spaces into the final encrypted message? Here's what I have achieved so far…
timelyfor
  • 49
  • 5
2
votes
2 answers

ROT2 cipher resulting in different than expected characters when deciphered with Python

I was having fun solving the riddles from the Pythonchallenge website when I stumbled upon a weird behaviour: With this input: *g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw…
apingaway
  • 33
  • 1
  • 1
  • 17
1
2
3
52 53