Sinisterly
Custom Cipher -- What do you think? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: General (https://sinister.ly/Forum-General)
+--- Forum: The Lounge (https://sinister.ly/Forum-The-Lounge)
+--- Thread: Custom Cipher -- What do you think? (/Thread-Custom-Cipher-What-do-you-think)



Custom Cipher -- What do you think? - Moros - 04-03-2017

(Disclaimer: Use the term "encrypt" loosely in this post. Sorry.)

A while ago (back in the ol' main JavaScript game, long before I got into hacking), I made a little cipher tool to send messages to a friend and receive them back without having anybody be able to read them. Basically just a mini-encryption (use the term loosely) to prevent mitm's, etc. I'd like to know whether this could be used on a higher level, and what people generally think of it. You can create a plain-text key, and then submit the key and JS gives it a number value based on it's first 5 ascii values and multiplied by some big number that I made up. Keep in mind, this is back in the (g)olden days when I wasn't very good and/or sensible with JavaScript.

Code:
function charChange(form) { var intinp = form.input.value var inparr = new Array(intinp.length) var arrplu = new Array(inparr.length) var newasc = new Array(arrplu.length) for (var i = 0; i < inparr.length; i++) { var lengthn = i var cca = intinp.charCodeAt(i) inparr[i] = cca var inppluss = ((inparr[i] + 2) + lengthn) + finalkey / 30000000 console.log(inppluss) var inpplu = Math.round(inppluss) console.log(inpplu); var arrdec = String.fromCharCode(inpplu) newasc[i] = arrdec var newascstr = newasc.join("") document.getElementById("output").value = newascstr } }

It changes the ascii values and adds some to the value to prevent against the counting of characters, then converts them back to text. For example,
Code:
aaaaaaaaa --> defghijkl
under a certain key. If I were to input "hello" and encrypt it with the same key,
Code:
hello --> kiqrv
.

Is there any flaw you can find in this? Also, tell me if you don't understand some of the code or would like me to explain it in further detail.


RE: Custom Cipher -- What do you think? - alureon - 04-03-2017

your code looks quite neat, however you may want to consider adding comments so other users can understand


RE: Custom Cipher -- What do you think? - Loki123 - 04-11-2017

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

Hello = 5 characters in length.
H = 1 + 2 = 3 = K
E = 2 + 2 = 4 = I
L = 3 + 2 = 5 = Q
L = 4 + 2 = 6 = R
O = 5 + 2 = 7 = V

The flaw isn't in the programming... It is your method in general.
How many patterns are in my table above ?

The length always starts from 1 and for each letter it is +1.
You always add two to it.
You always end up with a number that starts with 3 and + 1.

So for any text you send with this. I start by moving the first letter 3 to the left.
The second 4 to the left
The third 5 to the left
and so on.

There you have your flaw and why this would never be used in anything on a "higher" level.

P.S
This is just a little bit improved Caesar Cipher...


RE: Custom Cipher -- What do you think? - Blink - 04-11-2017

Welcome to boredom 101.



RE: Custom Cipher -- What do you think? - pvnk - 04-11-2017

(04-11-2017, 12:01 AM)Loki123 Wrote: 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

Hello = 5 characters in length.
H = 1 + 2 = 3 =  K
E = 2 + 2 = 4 =  I
L = 3 + 2 = 5 = Q
L = 4 + 2 = 6 = R
O = 5 + 2 = 7 = V

The flaw isn't in the programming... It is your method in general.
How many patterns are in my table above ?

The length always starts from 1 and for each letter it is +1.
You always add two to it.
You always end up with a number that starts with 3 and + 1.

So for any text you send with this. I start by moving the first letter 3 to the left.
The second 4 to the left
The third 5 to the left
and so on.

There you have your flaw and why this would never be used in anything on a "higher" level.

P.S
This is just a little bit improved Caesar Cipher...

Is just recursive.