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

#26 2012-01-16 08:11:01

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

Cool!

Is the output then always a number? Because I sort of want to hide the salt in the output.

EDIT: Also, your algorithm's output only depends on the final letter of the input, I'm pretty sure. Similar input has the same output.

Last edited by SeptimusHeap (2012-01-16 08:17:06)


http://i46.tinypic.com/dw7zft.png

Offline

 

#27 2012-01-16 09:07:39

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Hashing?

If you are using PHP and Panther, you could send something from Panther (a password for instance) to the PHP webpage which turns the string into a hash, then output the result a send the result to Panther.

So:
Panther Project would have:
[Get content from URL: (join "http://yourwebsite.com/md5.php?string=" with "(password)")]

and the PHP webpage (md5.php):

Code:

<?php echo md5($_GET['string']); ?>

With a salt, you add it to the string to be hashed as well.

Last edited by Magnie (2012-01-16 09:08:49)

Offline

 

#28 2012-01-16 09:49:03

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

Magnie wrote:

If you are using PHP and Panther, you could send something from Panther (a password for instance) to the PHP webpage which turns the string into a hash, then output the result a send the result to Panther.

So:
Panther Project would have:
[Get content from URL: (join "http://yourwebsite.com/md5.php?string=" with "(password)")]

and the PHP webpage (md5.php):

Code:

<?php echo md5($_GET['string']); ?>

With a salt, you add it to the string to be hashed as well.

Cool. Could you help host and code the php side of things?


http://i46.tinypic.com/dw7zft.png

Offline

 

#29 2012-01-16 10:10:27

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

Magnie wrote:

If you are using PHP and Panther, you could send something from Panther (a password for instance) to the PHP webpage which turns the string into a hash, then output the result a send the result to Panther.

So:
Panther Project would have:
[Get content from URL: (join "http://yourwebsite.com/md5.php?string=" with "(password)")]

and the PHP webpage (md5.php):

Code:

<?php echo md5($_GET['string']); ?>

With a salt, you add it to the string to be hashed as well.

Cool. Could you help host and code the php side of things?

Sorry, no. Long Explanation of why I don't use PHP for these kinds of things.

Offline

 

#30 2012-01-16 10:18:38

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

Magnie wrote:

SeptimusHeap wrote:

Magnie wrote:

If you are using PHP and Panther, you could send something from Panther (a password for instance) to the PHP webpage which turns the string into a hash, then output the result a send the result to Panther.

So:
Panther Project would have:
[Get content from URL: (join "http://yourwebsite.com/md5.php?string=" with "(password)")]

and the PHP webpage (md5.php):

Code:

<?php echo md5($_GET['string']); ?>

With a salt, you add it to the string to be hashed as well.

Cool. Could you help host and code the php side of things?

Sorry, no. Long Explanation of why I don't use PHP for these kinds of things.

?

All it would do is save usernames and passwords, it's not like an RPG or anything.


http://i46.tinypic.com/dw7zft.png

Offline

 

#31 2012-01-16 10:40:58

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Hashing?

You could use a little script binded to Scratch's sensor port, with Python or another lanuage. That'd work. (:


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#32 2012-01-16 10:43:18

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

Cool!

Is the output then always a number? Because I sort of want to hide the salt in the output.

It is, yes. You could convert the number to hexadecimal or something like that, but hiding the salt seems pointless, as a potential attacker could still access the salt.  hmm

EDIT: Also, your algorithm's output only depends on the final letter of the input, I'm pretty sure. Similar input has the same output.

Really? That's disappointing.  sad


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#33 2012-01-16 11:11:07

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

blob8108 wrote:

SeptimusHeap wrote:

Cool!

Is the output then always a number? Because I sort of want to hide the salt in the output.

It is, yes. You could convert the number to hexadecimal or something like that, but hiding the salt seems pointless, as a potential attacker could still access the salt.  hmm

EDIT: Also, your algorithm's output only depends on the final letter of the input, I'm pretty sure. Similar input has the same output.

Really? That's disappointing.  sad

sad

Here's what I'm planning to do.

Bob creates account with username/password combo:
Username: "Bob123"
Password: "golawnmowers123"

His password is hashed with salt 174716. The output is 746 (that's sort of the problem, the hashes are super short, the longer the hashes, the more passwords get different hashes, the harder it is to brute-force)

Now this salt is stored somewhere within the hash. In this case, let's say the position is the length of the input string divided by 15 (this is hard to do with such small hashes). Rounded up. In this case it's 1. The final hash that will be stored is:
717471646. The salt is underlined just to highlight it here, it wouldn't really be underlined. This is effectively Bob's password, but he doesn't know it. To a hacker, if the hashes were longer, it would be almost impossible to find the salt. Now what happens if Bob decides to log in again. Somehow his g key gets stuck and he types an extra 15 gs. (Again, if there were longer hashes, there would only need to be 1 extra g). This is the password:
"ggggggggggggggggolawnmowers123". The program would read that the salt would be located after the 2nd digit, so it would pick 747164 as the salt. This is incorrect and would hash the password differently to 2304. It would then insert the 747164 back in after the 2nd digit, like so: 2374716404. But even a smaller mistake such as "gilawnmowers123", although it would get the right salt, would (hopefully, if I can get a different hashing system) produce a different hash and result.

Last edited by SeptimusHeap (2012-01-16 11:11:46)


http://i46.tinypic.com/dw7zft.png

Offline

 

#34 2012-01-16 12:16:29

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Hashing?

@SeptimusHeap
I suppose doing it that way might work, but I'm not sure if you really understand the purpose of the salt. For all I know, that salted password could be for Bob123 could be golawnmowers123Bob123. As you can clearly see, it doesn't really make a huge difference. The purpose of a salt is so that a hacker has to figure out the salt so it can be deleted, allowing him to get the hash. (which a supercomputer could decrypt)


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#35 2012-01-16 12:28:42

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

bobbybee wrote:

@SeptimusHeap
I suppose doing it that way might work, but I'm not sure if you really understand the purpose of the salt. For all I know, that salted password could be for Bob123 could be golawnmowers123Bob123. As you can clearly see, it doesn't really make a huge difference. The purpose of a salt is so that a hacker has to figure out the salt so it can be deleted, allowing him to get the hash. (which a supercomputer could decrypt)

I know. The salt is added to the pass and hashed, and then stored in the hash for the next login. The cool thing about it is that the program needs the pass to get the salt, and the salt to get the pass, so it's very secure.


http://i46.tinypic.com/dw7zft.png

Offline

 

#36 2012-01-16 13:05:55

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Hashing?

Yeah, but just because it has a salt doesn't mean it's a good hash, or vice versa.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#37 2012-01-16 13:07:43

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

bobbybee wrote:

Yeah, but just because it has a salt doesn't mean it's a good hash, or vice versa.

No, I know.

This is for my CloudGaming client, and was sort of the main way of storing data  sad
If only I could figure it out.


http://i46.tinypic.com/dw7zft.png

Offline

 

#38 2012-01-16 13:09:50

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Hashing?

Oh. There is a difference between encryption and hashing, if CloudGaming is where this is going. You would hash the password, and then encrypt the data, perhaps having the key being the password.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#39 2012-01-16 13:12:12

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

bobbybee wrote:

Oh. There is a difference between encryption and hashing, if CloudGaming is where this is going. You would hash the password, and then encrypt the data, perhaps having the key being the password.

Hmm  hmm

This is being made in Panther, if that helps.


http://i46.tinypic.com/dw7zft.png

Offline

 

#40 2012-01-16 13:33:35

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Hashing?

It doesn't make any difference, these are just standard security tactics.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#41 2012-01-16 13:47:38

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Hashing?

Storing the salt as part of the hash is not secure; you might as well not have the salt. Even if you vary the position of the salt, you're still not increassing the search space very much (particularly if the randomly-generated salt has a fixed length). A salt only really makes sense if it's kept completely secure.  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#42 2012-01-16 15:07:41

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

Hmm... So what would  you recommend?


http://i46.tinypic.com/dw7zft.png

Offline

 

#43 2012-01-16 15:09:20

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Hashing?

hashing without a salt.


http://i.imgur.com/zeIZW.png

Offline

 

#44 2012-01-16 16:43:12

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Hashing?

I created a little hashing function in Scratch if anyone is interested: http://scratch.mit.edu/projects/Magnie/2276843

Code:

Length 10, Fast 0
magnie = 8457272181

Length 10, Fast 1
magnie = 8272736401

Last edited by Magnie (2012-01-16 16:46:35)

Offline

 

#45 2012-01-16 19:48:13

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

You are awesome.

Thank you.


http://i46.tinypic.com/dw7zft.png

Offline

 

#46 2012-01-16 23:14:16

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

You are awesome.

Thank you.

Who?

Offline

 

#47 2012-01-17 07:05:23

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Hashing?

Magnie wrote:

SeptimusHeap wrote:

You are awesome.

Thank you.

Who?

You.

Anyway, I imported it into Panther and everything got screwed up. I tried to fix it, but had to get rid of the length thing  hmm

Anyway, do you think it's fine to have different length hashes?


http://i46.tinypic.com/dw7zft.png

Offline

 

#48 2012-01-17 09:05:30

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

Anyway, do you think it's fine to have different length hashes?

I imagine having them the same length is easier, but it's up to you. Also, longer hashes should be harder to brute force.  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

Board footer