This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-07-02 00:18:21

mb1350
Scratcher
Registered: 2009-03-25
Posts: 9

Cipher Challenge

Hey, I recently found smartirishkid's 'codemaster' project and decided to expand on it to make a random cipher. That part I had no problem doing, but what I want to do now is to have it generate a cipher key that can be entered into the program to re-create the exact cipher used to make a phrase.

For instance, let's say you put in 'test' and get 'pstp'. if you were to restart the program and try to decode the code word you'd get a completely incorrect response (unless you are unimaginably lucky). However, if you are given a cipher key along with 'pstp' then you'd be able to enter the key and get 'test' as the decoded word.

Now, the simple solution to this is to have a very long cipher key that is 26 figures long, with numbers 1-26 representing each letter in the cipher. But there's no fun in that! So now here's what I need help with:

I want to create a program that can make a fairly short series of numbers and/or letters from a cipher (the cipher is a 26 character list) that contains every letter in the alphabet only once. here's a random cipher from my program as an example:

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

In order to be practical it should be at the most 13 characters long. And, after creating a key, the program should be able to take that same key and derive the correct cipher from it.

I've spent a lot of time pondering this problem and have come to the conclusion that I can't do it on my own  neutral  so any help at all would be appreciated. I don't want to put an unfinished project on the site but if you want to look at the programming then I'll put it up.

I'm thinking of trying my hand at version 1.4 to see if the new commands will help this problem. Thanks!

Last edited by mb1350 (2009-07-02 00:20:22)

Offline

 

#2 2009-07-02 06:22:25

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Cipher Challenge

I don't see how you can fit the information you are trying to capture (26 ordered characters) into a key of only 13 characters.  Unless there is some sort of relationship that can be used to generate the sequence.

But I'm certainly no code expert  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2009-07-02 08:08:15

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: Cipher Challenge

I might be able to help...

Offline

 

#4 2009-07-03 13:38:55

SmartIrishKid
Scratcher
Registered: 2008-07-19
Posts: 1000+

Re: Cipher Challenge

I could help.  Considering it's based on my project  smile


Discuss future Scratch RPGs, online games, and more!

Offline

 

#5 2009-07-03 13:45:49

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: Cipher Challenge

1.4 has a nice box where users can input strings, such as plaintext for a code. You could add each letter seperately to a list, using
Add letter (x) of (plaintext) to (list)
Then replace each letter with code letters and join them together.

That's if you get 1.4 though, which i would recommend!


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#6 2009-07-06 23:21:18

mb1350
Scratcher
Registered: 2009-03-25
Posts: 9

Re: Cipher Challenge

The only problem I have with entering the cipher manually is that it seems (to me at least) to take away from the fun of having an encoder/decoder. If I have to that will be my last resort but I have a few more ideas to try instead.

For one of my ideas I would have to retool how the cipher is generated: I'm thinking of having the program pick a random number (Call it 'n') and printing each successive letter in the alphabet at the n-th spot on the cipher. if that spot is already occupied the program would move on to the next available spot in the cipher. The cipher code would simply be 'n'. It gives the illusion of a totally random cipher, but for some reason it doesn't quite satisfy me.

The reason I don't really want such a simple solution is because I took on this project to challenge myself in making computer-like programs; programs that are many times more what you see when you play them on the website. Hm... I could add some aspects of that number to make it even more random, such as a digit that marks where in the alphabet the program starts listing the letters...

If anyone wants to work with me on this I'll gladly cooperate. I might not have much time for the remainder of the week but I'll see what I can fit in.

Offline

 

#7 2009-07-07 15:01:45

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: Cipher Challenge

mb1350 wrote:

For one of my ideas I would have to retool how the cipher is generated: I'm thinking of having the program pick a random number (Call it 'n') and printing each successive letter in the alphabet at the n-th spot on the cipher. if that spot is already occupied the program would move on to the next available spot in the cipher. The cipher code would simply be 'n'. It gives the illusion of a totally random cipher, but for some reason it doesn't quite satisfy me.

But if you did that, it would only shift the alphabet over one... Hmm. In 1.4 you can set varables to letters. The only problem is that you can't pick the same letter twice. I'll have to think about that...


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#8 2009-07-07 15:26:41

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: Cipher Challenge

I figured out how to do it, using a list. It's complicated but here is a project that demonstrates a random cipher alphabet. I hope it works for you  smile

Random Cipher Alphabet Generator


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#9 2009-07-07 17:10:53

mb1350
Scratcher
Registered: 2009-03-25
Posts: 9

Re: Cipher Challenge

Whew! I finished the program, it can now be found here: http://scratch.mit.edu/projects/mb1350/603158

I took the time with this version to improve the function and the looks. I used 1.4 so there might be some bugs there.

Last edited by mb1350 (2009-07-11 00:32:36)

Offline

 

Board footer