• 0

I am writing a ceaser cipher


Question

hello all I am writing ceaser cipher in java (to go along with a massive encryption tool when its all done)...

I just wanted a few opinions really...

should I include special characters? like punctuation ... if I leave puntuation out of a cipher it could be easier to decrypt ... example

hello bob, how is you're mother?

could looks like

gyrrq tqt, gqp dz uqi'wy fqmgyw?

obviously I can see that the first word is probably hello and that the second is a name or something to address someone due to the normal letter lay out if wrong I can for sure see the " ' " which would suggest "re" .... but if I remove all punctuation sentences can become hard to understand or meanings can change all together.

also should i make everything a standard lower case? this is my alphabet char array so far:

{'a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',

'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1',

'2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '\"', ',', '@', '[', ';', '#', ']', '-', '_', '~', '{', '}', '?', '*', '?',};

is this going a bit OTT? or good to allow proper communication? i need to add more special characters and maybe remove the caps (as most people would assume the first would be a cap in a sentence which allows a small amount of elimination)

opinions? thoughts? ideas? extras?

Link to comment
https://www.neowin.net/forum/topic/1154212-i-am-writing-a-ceaser-cipher/
Share on other sites

14 answers to this question

Recommended Posts

  • 0

What type of encryption tool are you going to write that uses a caesar cipher?

Ceaser ciphers are pretty weak for security, as are most rotational ciphers, so I hope its not meant to protect something valuable. ROT13 is another good one to play with, but it doesnt use punctuation, only letters of the alphabet.

If you really wanted to mess with someone, make it load the russian cyrillic alphabet as a cipher :p

  • 0

What type of encryption tool are you going to write that uses a caesar cipher?

meh just an extra layer ... its ceaser ciphers (maybe going into enigma) the ciphered text will then be encrypted using RSA with an optional AES

Ceaser ciphers are pretty weak for security, as are most rotational ciphers, so I hope its not meant to protect something valuable. ROT13 is another good one to play with, but it doesnt use punctuation, only letters of the alphabet.

If you really wanted to mess with someone, make it load the russian cyrillic alphabet as a cipher :p

ha! I like that sounds amusing ... like i said just adding it on for that little bit extra ya know :p

  • 0

"meh just an extra layer"

"will then be encrypted using RSA with an optional AES"

So in other words utterly pointless.. Like mac filtering or disabling your dhcp server as "extra security layer" on your wireless while your using WPA2.

Clearly not following KISS

  • 0

"meh just an extra layer"

"will then be encrypted using RSA with an optional AES"

So in other words utterly pointless.. Like mac filtering or disabling your dhcp server as "extra security layer" on your wireless while your using WPA2.

Clearly not following KISS

pretty much pointless yes , just for practice mostly! it wont do anything.... except annoy who ever is trying to decrypt it as well as suck up processing power lol !

  • 0

"annoy who ever is trying to decrypt it"

So you mean after they break RSA or AES -- so your talking someone with the computer power of a small country at his disposable? You mean that guy, that guy that really wants to know those launch codes SPEhosting is sending via some special code he wrote.. That guy?

I am fairly sure, nobody is going to spend 2 seconds on "cracking" your encryption - unless you put some sort of prize on it in the 1,000's of dollars, etc. Now if in the 100's of Ks or Millions you might get some serious people trying to break it. If not then sorry nobody is going to be wasting time trying to break your "practice" code.

Thats great if you want to practice, practice with something useful - so some software using using a "Caesar Cipher" based encryption makes sense. But then wrapping it inside of AES, that is not practice that is just pointless complexity that serves no purpose.

KISS!!

  • Like 3
  • 0

"annoy who ever is trying to decrypt it"

So you mean after they break RSA or AES -- so your talking someone with the computer power of a small country at his disposable? You mean that guy, that guy that really wants to know those launch codes SPEhosting is sending via some special code he wrote.. That guy?

I am fairly sure, nobody is going to spend 2 seconds on "cracking" your encryption - unless you put some sort of prize on it in the 1,000's of dollars, etc. Now if in the 100's of Ks or Millions you might get some serious people trying to break it. If not then sorry nobody is going to be wasting time trying to break your "practice" code.

Thats great if you want to practice, practice with something useful - so some software using using a "Caesar Cipher" based encryption makes sense. But then wrapping it inside of AES, that is not practice that is just pointless complexity that serves no purpose.

KISS!!

wow you are just a bundle of joy to day aint ya :p lol the RSA and AES have a very vital role in my program, its for a secure communication which will be built in to android communications (text messaging and hopefully phone calls, which may be a little harder) I have already started this app in a basic messenger style (which is easy as hell) but I want to make it so people can use their text messages and minutes rather then their data allowence. the point of RSA being included is so that people dont have to have a key they made up... because lets face it people would send the password via a plain text message and make the whole thing rather pointless...

your right the cipher is POINTLESS it has no point in this program and wont be in my final version, I just thought it would be fun way to kill a boring night (i know how sad that sounds)

  • 0

your right the cipher is POINTLESS it has no point in this program and wont be in my final version, I just thought it would be fun way to kill a boring night (i know how sad that sounds)

Writing a Ceaser cipher encrypter/decrypter is acceptable fun (a few years ago I implemented a few algorithms to do brute force decryption and things like frequentist analysis to break things like Affine ciphers).

I think its more that you worry us by writing your own encryption layer AND THEN planning to use it in an actual application. Something that should never need to be done.

  • 0

hello bob, how is you're mother?

could looks like

gyrrq tqt, gqp dz uqi'wy fqmgyw?

Are you sure you even know what a Caesar cipher is? That's not encrypted with a Caesar cipher... a Caesar cipher is a type of substitution cipher where you shift by a constant.

h->g is +1, l->r is +6, o->q is +2... they should be the same... if not, don't call it a Caesar cipher. It's a generic substitution cipher... which, admittedly, is more secure... but so incredibly insecure that it's almost as good as unencrypted. But not the point if you're just having fun :)

Anyway, to answer your question:

char c = 'a';

char c_shifted = (char)((((int)c)+2)%256)

Something along those lines... convert the character to an ASCII value, add a constant (here, 20), then compute the modulus with 256 (assuming 8 bit chars...), then convert back to a char.

  • 0

Are you sure you even know what a Caesar cipher is? That's not encrypted with a Caesar cipher... a Caesar cipher is a type of substitution cipher where you shift by a constant.

h->g is +1, l->r is +6, o->q is +2... they should be the same... if not, don't call it a Caesar cipher. It's a generic substitution cipher... which, admittedly, is more secure... but so incredibly insecure that it's almost as good as unencrypted. But not the point if you're just having fun :)

Anyway, to answer your question:

char c = 'a';

char c_shifted = (char)((((int)c)+2)%256)

Something along those lines... convert the character to an ASCII value, add a constant (here, 20), then compute the modulus with 256 (assuming 8 bit chars...), then convert back to a char.

yes i know what a ceaser cipher is i just used random letters in the example to get my explination across I couldnt be bothered to actually do one for an example

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • "it opens up new doors for people who prefer using Edge, but cannot be bothered to configure a Microsoft account" You already have a Microsoft account if you are using Windows 11, because you can't set it up without one.
    • This is how much iPhone 18 Pro could cost after Apple's price hike confirmed by Hamid Ganji Image via Apple Apple CEO Tim Cook confirmed in a recent interview that the company may have to raise prices on some of its products due to the ongoing memory shortage. While he did not elaborate on the scale of the price hikes, new estimates suggest that Pro iPhone models could become significantly more expensive this fall. The Wall Street Journal and research firm TechInsights have come up with an educated estimate of how much the upcoming iPhone 18 Pro could cost after its launch in September. The estimate is based on current increases in memory and storage chip prices. For starters, the iPhone 18 Pro base model is expected to feature 12GB of RAM and 256GB of internal storage. According to TechInsights estimates, 12GB of DRAM for the iPhone 17 Pro cost Apple $39 last year. However, for the iPhone 18 Pro, the cost of the same amount of DRAM could soar to $145. Likewise, 256GB of flash storage that previously cost $13 could now cost around $51. Producing a base iPhone 17 Pro reportedly cost Apple around $582, but TechInsights estimates that the production cost of the iPhone 18 Pro could rise to $726. If Apple wants to maintain the roughly 47% profit margin it enjoys on the iPhone 17 Pro, the base price of the iPhone 18 Pro would need to reach $1,371. After standard pricing adjustments, customers could end up paying around $1,299 for the base model. However, that may not be the end of the story. As we previously reported, the iPhone 18 Pro is said to feature a variable-aperture lens, which could cost Apple at least 50% more than the current camera system. The estimated $1,299 price tag does not include the additional cost of this upgraded camera hardware. Once that expense is factored in, the base model could cost at least $1,399. A $1,399 price tag for the base iPhone 18 Pro would represent a significant increase over the current $1,099 starting price of the iPhone 17 Pro. If Apple wants to keep its upcoming iPhones competitive, it may need to accept lower profit margins.
    • Oh man, but what if I have the PS3 version?
    • Floorp 12.15.0 by Razvan Serea Floorp is a cutting-edge web browser that combines the trusted foundation of Mozilla's Firefox with a unique Japanese perspective, offering users an exceptional online experience. This open-source browser prioritizes privacy, customization, and security. Floorp is transparent, with no user tracking or data sharing, and it's completely open source. With a strict no-tracking policy and full transparency, your personal information remains private. As an open-source project, Floorp not only shares its source code but also its build environment, inviting users to contribute and build their unique versions. The regular updates, based on Firefox ESR, ensure that you always have the latest features and security enhancements. Floorp key features: Strong Tracking Protection: Floorp offers robust tracking protection, safeguarding users from malicious tracking and fingerprinting on the web. Flexible Layout: Customize Floorp's layout to your heart's content, including moving the tab bar, hiding the title bar, and more for a personalized browsing experience. Switchable Design: Choose from five distinct designs for the Floorp interface, and even switch between OS-specific designs for a unique look Regular Updates: Based on Firefox ESR, Floorp receives updates every four weeks, ensuring up-to-date security even before Firefox's releases. No User Tracking: Floorp prioritizes user privacy by abstaining from collecting personal information, tracking users, or selling user data, with no affiliations with advertising companies. Completely Open Source: The full source code for Floorp is open to the public, allowing transparency and enabling anyone to explore and build their own version. Dual Sidebar: Floorp features a versatile built-in sidebar for webpanels and browsing tools, making it perfect for multitasking and quick access to bookmarks, history, and websites. Flexible Toolbar & Tab Bar: Customize your browser with Tree Style Tabs, vertical tabs, and bookmark bar modifications, catering to both beginners and experts in customization. User-Centric Web Experience: Floorp prioritizes user privacy and collaboratively blocks harmful trackers. Floorp 12.15.0 changelog: Refine appearance of Start top sites and Hub sidebar by @CutterKnife in #2435 Improvement command pallete by @Walkmana-25 in #2429 Fix gesture command by @Walkmana-25 in #2425 Add Mac OS formatting for modifier keys in shortcut editor by @Walkmana-25 in #2424 refactor: bridge as little by @nyanrus in #2416 fix(pwa): follow Firefox 150 ShellService API changes (Bug 1985098) by @Ryosuke-Asano in #2409 feat(notes): Desktop向けThree-Way Merge Sync実装 by @Ryosuke-Asano in #2402 fix(pages-settings): resolve Invalid Hook Call error in SortableContext by @Ryosuke-Asano in #2350 README: fix signpath avatar url by @CutterKnife in #2453 Enhance command palette with new actions by @Walkmana-25 in #2449 feat(split-view): implement tab drop functionality with overlay and new window zone by @Ryosuke-Asano in #2445 fix: restore 'Hide Interface', 'Toggle Navigation Panel', and 'Rest Mode' keyboard shortcuts by @Ryosuke-Asano in #2458 fix: prevent unified extensions panel from closing on bottom navbar (#2079) by @Ryosuke-Asano in #2462 fix: prevent workspace system from overriding SessionStore tab selection on startup by @Ryosuke-Asano in #2461 fix: prevent multi-row tabs from disappearing when sidebar opens website by @Ryosuke-Asano in #2460 fix: prevent private container tab from saving first page to history by @Ryosuke-Asano in #2459 fix: prevent browser close when container tab is the only tab open by @Ryosuke-Asano in #2465 Resolve conflicts for #2467: Add split-view mouse gesture commands by @Ryosuke-Asano in #2472 fix(os-server): auto-generate auth token on enable by @Ryosuke-Asano in #2471 fix(settings): change broken link to Floorp Docs by @regularentropy in #2477 Enhanced search functionality in the command palette — now supports English keywords, Japanese morphological analysis, and hiragana search by @Walkmana-25 in #2470 fix(patches): align Gecko patches with Linux CI runtime by @Ryosuke-Asano in #2482 feat(pwa): add Firefox Container support for PWA apps by @Ryosuke-Asano in #2443 fix(statusbar): add event listener for buttons in status bar by @greeeen-dev in #2484 Download: Floorp 64-bit | 95.0 MB (Open Source) Links: Floorp Website | Github Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Google Gemini co-lead Noam Shazeer is leaving for OpenAI by Pradeep Viswanathan Noam Shazeer is best known as one of the co-authors of the 2017 “Attention Is All You Need” paper, which introduced the Transformer architecture that now powers most large language models. He also worked on several major Google AI projects, including LaMDA, before leaving the company in 2021 to co-found Character.AI. He also authored the Sparsely-gated Mixture of Experts (2016) paper, which is popular among the AI community. After falling behind OpenAI and Anthropic a couple of years ago, Google brought Shazeer back in 2024 as part of a major deal with Character.AI. Through this deal, along with Noam, several other researchers returned to Google DeepMind. More recently, he was a vice president of engineering at Google and a technical co-lead for Gemini. Today, Noam Shazeer announced on X that he is leaving Google and joining OpenAI. In his post, Shazeer said it was a difficult decision to move on, adding that he was proud of the Google team and what it had built together. OpenAI CEO Sam Altman welcomed the move with a post of his own, saying Shazeer was one of the people he had most wanted to work with since OpenAI’s early days. Google has made strong progress with Gemini over the past year, closing the gap with OpenAI in several areas. But losing Noam Shazeer is a major talent setback for them, especially after bringing him back less than two years ago by spending a fortune. For OpenAI, the hire adds one of the industry’s most experienced language model researchers to a team that is already pushing ahead with ChatGPT, Codex, and its next generation of frontier models.
  • Recent Achievements

    • Week One Done
      Classifyskilleducation earned a badge
      Week One Done
    • One Month Later
      eurospharma62 earned a badge
      One Month Later
    • Week One Done
      With What earned a badge
      Week One Done
    • Week One Done
      Harris Gilbert earned a badge
      Week One Done
    • One Month Later
      Vincian earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      541
    2. 2
      +Edouard
      171
    3. 3
      PsYcHoKiLLa
      85
    4. 4
      ATLien_0
      64
    5. 5
      neufuse
      64
  • Tell a friend

    Love Neowin? Tell a friend!