itsmomito wrote:
Hey guys, I don't know much about encryption, but I would like to try making one. Could I join in? I will upload it as soon as i'm finished
Cool. I don't know much either, but substitutions are right within my limits.
Offline
Bobbybee: That's why I suggested this method a few posts up.
itsmomito: Feel free to build an encryption system and submit it!
Ohaiderstudios: A hash could be used to keep the actual password hidden from the owner of the server. Good idea. Just hope it's secure.
Offline
Magnie wrote:
Bobbybee: That's why I suggested this method a few posts up.
itsmomito: Feel free to build an encryption system and submit it!
Ohaiderstudios: A hash could be used to keep the actual password hidden from the owner of the server. Good idea. Just hope it's secure.
It's not, but let's just say that my classmates aren't exactly cryptographers
Offline
Another update on what we could use for a symmetric algorithm.
If we could create a XOR operator (using only Scratch blocks), we might be able to implement Blowfish.
I just realized that we'd have to split the string into blocks.. which might take a long time to run. :/ We'll see.
We also need a protocol. How will the encryption work? Will we have some encrypted data (like only passwords and the sort) or are we just gonna encrypt everything? Remember, messages are sent like this:
sensor-update "variable" "value"
broadcast "message"
And we can't change that format. So we are stuck with specific variables or something to signify that the data is encrypted. I was thinking of something like:
broadcast "&>>[insert encrypted data"
sensor-update "&>>" "[encrypted data]"
But of course, Scratch and the Server need to exchange the key first. So, any thoughts?
Last edited by Magnie (2012-04-25 23:31:10)
Offline
Well guys... I'm certainly not an expert in anything related to cryptography. But I researched a little and came up with something, not sure if it is even an encryption lol.
Here's the link: http://scratch.mit.edu/projects/itsmomito/2496170
How it works: This basically has two sprites which can be placed into separate projects to communicate over the web. Each sprite generates a random key containing 5 to 100 values ranging from 10-99. The two keys are combined and used to encrypt the text. Inside of the scratch project, there is a list of all the possible inputs a user can convert. If the user types in a character not inside the list, the program will not function. However, I inserted all the values I could type on my keyboard
The Encryption: I think this might be what you were calling the "shift" encryption. It just finds each string letter's position in the possible values list and shifts the letter according to the value of the encryption key. Not sure if this is so secure, probably not. But it's my first attempt
Offline
Magnie wrote:
If we could create a XOR operator (using only Scratch blocks)...
here you go
I made it specifically for 8 bit decimal sequences, but just change how many times it loops and it will work for any length.
Offline
itsmomito: That's actually really cool! It seems quite fast as well. Even though it is a shift-cipher, that's really good! Have you looked at Deffie's Key-Exchange protocol? That's the method we'll be using to create the key.
I'm trying to decide what numbers to use (I don't know how to calculate primitive roots and all my math teachers either don't know or say it's too complicated for me). I know of two from an example one though: p=157, g=5. So if you could base your key generator on those values (the Deffie exchange explains how the random integers should be chosen).
ohaiderstudios: Thank you! Next we need a letter to binary now. One that supports all the letters on the keyboard, all 0-255 won't work because Scratch doesn't support them all very well.
Also, for everyone: I suggest making all the variables private (except for three, input1, input2, and output, make sure they are unique like "xor_input1") so it doesn't collide with any other sprites/variables and stuff. That way it's easily implementable into projects.
I'm going to see about working on a server plugin (for Scratch Space) that can be used to test Secure Mesh.
Offline
Magnie wrote:
itsmomito: That's actually really cool! It seems quite fast as well. Even though it is a shift-cipher, that's really good! Have you looked at Deffie's Key-Exchange protocol? That's the method we'll be using to create the key.
I'm trying to decide what numbers to use (I don't know how to calculate primitive roots and all my math teachers either don't know or say it's too complicated for me). I know of two from an example one though: p=157, g=5. So if you could base your key generator on those values (the Deffie exchange explains how the random integers should be chosen).
ohaiderstudios: Thank you! Next we need a letter to binary now. One that supports all the letters on the keyboard, all 0-255 won't work because Scratch doesn't support them all very well.
Also, for everyone: I suggest making all the variables private (except for three, input1, input2, and output, make sure they are unique like "xor_input1") so it doesn't collide with any other sprites/variables and stuff. That way it's easily implementable into projects.
I'm going to see about working on a server plugin (for Scratch Space) that can be used to test Secure Mesh.
Hmmm Okay then
Offline
Okay, another update! I've ported the Deffie Key-Exchange from a Python script to Scratch. You can see it here.
For some reason only numbers between 1-5 work (might be larger like 1-7, but I've only verified 1-5). alice_key and bob_key need to match each other. I used billyward's (I think that's his username) power algorithm. Any ideas on how to increase the limit from 1-5 to something larger like 1-1000? Also, if you don't mind, could you give me the numbers from alice_sint and bob_sint when the two keys match?
A couple things I modified, was that I added a round() around the power() algorithm. That may be a reason why, but sometimes I get numbers like "-1.42345879" or other e^## results, without a round() function around it.
I'll experiment some more and report my results later.
Last edited by Magnie (2012-04-26 20:15:49)
Offline
Umm, can we use BYOB for the contest?
Cause I've developed a hashing algorithim in BYOB that does it at the bit level.
Last edited by SJRCS_011 (2012-04-27 11:39:26)
Offline
SJRCS_011 wrote:
Umm, can we use BYOB for the contest?
Cause I've developed a hashing algorithim in BYOB that does it at the bit level.
Sure! Each contest will be for a different mod. So Panther, BYOB, etc.
Offline
Magnie wrote:
Okay, another update! I've ported the Deffie Key-Exchange from a Python script to Scratch. You can see it here.
For some reason only numbers between 1-5 work (might be larger like 1-7, but I've only verified 1-5). alice_key and bob_key need to match each other. I used billyward's (I think that's his username) power algorithm. Any ideas on how to increase the limit from 1-5 to something larger like 1-1000? Also, if you don't mind, could you give me the numbers from alice_sint and bob_sint when the two keys match?
A couple things I modified, was that I added a round() around the power() algorithm. That may be a reason why, but sometimes I get numbers like "-1.42345879" or other e^## results, without a round() function around it.
I'll experiment some more and report my results later.
Sorry Magnie, I couldn't figure out the solution to your problem when I took a look. Actually, i tried making the deffie key encryption too. It works but I don't know if I did it right, I will upload it soon.
Edit: Here is my attempt http://scratch.mit.edu/projects/itsmomito/2500310 If the output isn't the input then press the flag a few times
Last edited by itsmomito (2012-04-28 16:56:45)
Offline
Most Logical Bitwise Operators in Scratch
...I was on a roll...
Offline
Sweet! This is coming along quite nicely!
itsmomito: Good job with the encryption system. Sometimes a couple of letters decrypt a letter off (like d instead of e).
ohaiderstudios: Thanks! That should help a ton!
I also just realized that Blowfish uses S-Boxes, which I have no idea what those are. So I'm afraid we'll have to use something else.
Offline
While putzing around Wikipedia, I discovered a method of hashing called CRC.
After studying it for a while, I made a similar function using Python:
class remaen(): """ Returns a hashing object, optionally initialized with a string. """ def __init__(self, txt=""): self.s = txt def update(self, txt): """ Append data to the hash value """ self.s += txt def hexdigest(self): """ Returns a 128-bit hexadecimal string """ self.k = [] for self.i in self.s: self.t = bin(ord(self.i)).split("b")[1] while len(self.t) < 8: self.t = "0" + self.t self.k.append(self.t) for self.i in range(128): self.k.append("0") self.k = [self.i for self.i in "".join(self.k)] while len(self.k) > 128: while self.k[0] == "0": self.k.pop(0) if len(self.k) < 129: break self.t = "" for i in range(129): self.t += self.k.pop(0) self.r = bin(int(self.t, 2) ^ 0x1345e414d7294b9a209b23b0972968d33).split("b")[1] self.k.insert(0, self.r) self.k = [self.i for self.i in "".join(self.k)] while len(self.k) < 128: self.k.insert(0, "0") self.h = [] for self.i in range(32): self.t = self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) self.t = hex(int(self.t, 2)).split("x")[1] self.h.append(self.t) return "".join(self.h) def digest(self): """ Returns a 128-bit binary string """ self.k = [] for self.i in self.s: self.t = bin(ord(self.i)).split("b")[1] while len(self.t) < 8: self.t = "0" + self.t self.k.append(self.t) for self.i in range(128): self.k.append("0") self.k = [self.i for self.i in "".join(self.k)] while len(self.k) > 128: while self.k[0] == "0": self.k.pop(0) if len(self.k) < 129: break self.t = "" for i in range(129): self.t += self.k.pop(0) self.r = bin(int(self.t, 2) ^ 0x1345e414d7294b9a209b23b0972968d33).split("b")[1] self.k.insert(0, self.r) self.k = [self.i for self.i in "".join(self.k)] while len(self.k) < 128: self.k.insert(0, "0") self.h = [] for self.i in range(16): self.t = self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) + self.k.pop(0) self.t = chr(int(self.t, 2)) self.h.append(self.t) return "".join(self.h)
Now to port it to Scratch...
Offline
New one: shift cypher.
http://scratch.mit.edu/projects/GeonoTRON2000/2508540
If you want a decrypter, make one yourself. It hurts my brain just to look at that.
Offline
GeonoTRON2000 wrote:
New one: shift cypher.
http://scratch.mit.edu/projects/GeonoTRON2000/2508540
If you want a decrypter, make one yourself. It hurts my brain just to look at that.
Haha, I just responded to your comment with asking you to make one. xD
Offline
Magnie wrote:
GeonoTRON2000 wrote:
New one: shift cypher.
http://scratch.mit.edu/projects/GeonoTRON2000/2508540
If you want a decrypter, make one yourself. It hurts my brain just to look at that.Haha, I just responded to your comment with asking you to make one. xD
XP I just switched the +es for -es, and then it worked.
Offline
Bump.
Sorry I haven't been active lately, I have a lot of stuff to work on at school.
Offline
ohaiderstudios wrote:
Bump.
Sorry I haven't been active lately, I have a lot of stuff to work on at school.
CRTs are coming up, that's how life is. So no worries.
I've come up with an encryption idea. What happens, is you convert the text to binary then you take the first 8 bits of the string and the first 8 bits of the key, stick them together, cut off the first 4 bits and the last 4 bits. Then you move on to the next 8 bits, and repeat the process until you finish.
I'm thinking of XORing something somewhere, but I don't know.
Offline
Magnie wrote:
ohaiderstudios wrote:
Bump.
Sorry I haven't been active lately, I have a lot of stuff to work on at school.CRTs are coming up, that's how life is. So no worries.
I've come up with an encryption idea. What happens, is you convert the text to binary then you take the first 8 bits of the string and the first 8 bits of the key, stick them together, cut off the first 4 bits and the last 4 bits. Then you move on to the next 8 bits, and repeat the process until you finish.
I'm thinking of XORing something somewhere, but I don't know.
How exactly would you decrypt...?
It seems like you would be losing too much data.
Last edited by ohaiderstudios (2012-05-05 22:19:36)
Offline
ohaiderstudios wrote:
Magnie wrote:
ohaiderstudios wrote:
Bump.
Sorry I haven't been active lately, I have a lot of stuff to work on at school.CRTs are coming up, that's how life is. So no worries.
I've come up with an encryption idea. What happens, is you convert the text to binary then you take the first 8 bits of the string and the first 8 bits of the key, stick them together, cut off the first 4 bits and the last 4 bits. Then you move on to the next 8 bits, and repeat the process until you finish.
I'm thinking of XORing something somewhere, but I don't know.How exactly would you decrypt...?
It seems like you would be losing too much data.
No idea. I haven't gotten that far yet. xD
Why is it that all my awesome ideas fall short? I had an awesome compression idea but when I tried to create it, it didn't work.
Offline
Magnie wrote:
ohaiderstudios wrote:
Magnie wrote:
CRTs are coming up, that's how life is. So no worries.
I've come up with an encryption idea. What happens, is you convert the text to binary then you take the first 8 bits of the string and the first 8 bits of the key, stick them together, cut off the first 4 bits and the last 4 bits. Then you move on to the next 8 bits, and repeat the process until you finish.
I'm thinking of XORing something somewhere, but I don't know.How exactly would you decrypt...?
It seems like you would be losing too much data.No idea. I haven't gotten that far yet. xD
Why is it that all my awesome ideas fall short? I had an awesome compression idea but when I tried to create it, it didn't work.
99% of my ideas end up in failure as well.
That's just a part of the life of a programmer I guess...
Offline
I'm actually on the verge of a MAJOR breakthrough on Cascade, my encryption system I'm writing in Python.
Ohaider
Chief Theoretical Cryptographer
Offline