Answer the question
In order to leave comments, you need to log in
Give me an idea how to implement a Caesar cipher in JS?
It is necessary to implement a script that would encrypt the text using the Caesar Cipher (each letter of the text is shifted by +-n characters to the right / left relative to its position in the alphabet). I am just starting to program, so only one implementation idea was born - to receive a unicode character and shift accordingly.
My way of implementation seems to me govnokoda.
codepen.io/heyjoe/pen/wKKgeG
Please tell me other ways to implement this script.
Answer the question
In order to leave comments, you need to log in
The idea is to make a list of all letters that can be converted.
If someone enters a string with characters outside of this list, such as hieroglyphs, then they will not be shifted, because they are not in the list.
You distill the entire string into a letter-by-character array and iterate through its elements
For each character, set a condition check and replace the contents of the array element with the desired character
And reverse mirror decoding operation
But there is no cryptographic strength at all
Because there is a frequency of using characters in each language, it has its own
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question