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

#1 2012-01-15 13:23:34

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

Hashing?

Is there a way I can hash a string? I have already made a salt generator. Any ideas? I know how to store the salt and rehash the string to check if the password is correct, but how do I apply the hash and salt to the string?


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

Offline

 

#2 2012-01-15 13:35:34

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Hashing?

in what language?


http://i.imgur.com/1QqnHxQ.png

Offline

 

#3 2012-01-15 13:37:18

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

Re: Hashing?

Try a simple one. Start by taking apart the string into a list. When doing this, put it against a ascii to convert to binary. Once in binary, using hashing techniques. For a real world example, you could refer to this wikipedia page on MD5 - http://en.wikipedia.org/wiki/MD5#Algorithm Once implemented, you can hash a string with MD5 (or any algorithm of your choice) However, you must code in a truth table so you can do bitwise operations.


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

Offline

 

#4 2012-01-15 13:52:17

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

Re: Hashing?

This is in scratch, by the way.


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

Offline

 

#5 2012-01-15 13:57:07

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

Re: Hashing?

Yeah, that is why I explained that you needed to separate the string into binary, with a table. Should I post a project showing that type thing?


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

Offline

 

#6 2012-01-15 14:00:29

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

Re: Hashing?

Sure.


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

Offline

 

#7 2012-01-15 14:20:42

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

Re: Hashing?

Alright. I gotta build a table though. (with a C program, of course!)


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

Offline

 

#8 2012-01-15 14:29:46

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

Re: Hashing?

bobbybee wrote:

Alright. I gotta build a table though. (with a C program, of course!)

So how does hashing work exactly?

All I can find is how salts are created and stored within the hashed password.


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

Offline

 

#9 2012-01-15 14:31:51

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

Re: Hashing?

Did you read the page on wikipedia I linked earlier? Also, I put the binary project online (assuming I didn't make any careless mistakes).


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

Offline

 

#10 2012-01-15 14:34:29

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

Re: Hashing?

I understand very little of that article  tongue


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

Offline

 

#11 2012-01-15 14:38:33

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

Re: Hashing?

Do you know bitwise operations?


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

Offline

 

#12 2012-01-15 14:38:58

G0D_M0D3
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

I understand very little of that article  tongue

Sorry if this seems spammy, but is the block library dead?

I remember you as a dev, am I right? Or was that a mod, or website...

Anyways, is it dead?


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#13 2012-01-15 14:53:44

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

Re: Hashing?

G0D_M0D3 wrote:

SeptimusHeap wrote:

I understand very little of that article  tongue

Sorry if this seems spammy, but is the block library dead?

I remember you as a dev, am I right? Or was that a mod, or website...

Anyways, is it dead?

I was a Panther dev.

And yes, Sparks still updates the library.

bobbybee wrote:

Do you know bitwise operations?

Nope.


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

Offline

 

#14 2012-01-15 14:59:55

Servine
Scratcher
Registered: 2011-03-19
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

G0D_M0D3 wrote:

SeptimusHeap wrote:

I understand very little of that article  tongue

Sorry if this seems spammy, but is the block library dead?

I remember you as a dev, am I right? Or was that a mod, or website...

Anyways, is it dead?

I was a Panther dev.

And yes, Sparks still updates the library.

bobbybee wrote:

Do you know bitwise operations?

Nope.

Hashing isnt the best way. I first thought of that, but there are plent of hash decrypters. Infact, I think you should encrypt it yourself

I got the awesome idea.

If someone manages to get to the project, create a hidden sprite, and put all the decrypting stuff there, that way, it would be almost impossible to decrypt.


http://bluetetrarpg.x10.mx/usercard/?name=Servine

Offline

 

#15 2012-01-15 15:01:26

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

Re: Hashing?

Servine wrote:

SeptimusHeap wrote:

G0D_M0D3 wrote:


Sorry if this seems spammy, but is the block library dead?

I remember you as a dev, am I right? Or was that a mod, or website...

Anyways, is it dead?

I was a Panther dev.

And yes, Sparks still updates the library.

bobbybee wrote:

Do you know bitwise operations?

Nope.

Hashing isnt the best way. I first thought of that, but there are plent of hash decrypters. Infact, I think you should encrypt it yourself

I got the awesome idea.

If someone manages to get to the project, create a hidden sprite, and put all the decrypting stuff there, that way, it would be almost impossible to decrypt.

Servine, if you hash using a salt, it's near impossible to decrypt if you hide the salt (as I plan to do)


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

Offline

 

#16 2012-01-15 15:02:45

Servine
Scratcher
Registered: 2011-03-19
Posts: 1000+

Re: Hashing?

SeptimusHeap wrote:

Servine wrote:

SeptimusHeap wrote:

G0D_M0D3 wrote:

Sorry if this seems spammy, but is the block library dead?

I remember you as a dev, am I right? Or was that a mod, or website...

Anyways, is it dead?

I was a Panther dev.

And yes, Sparks still updates the library.

Nope.

Hashing isnt the best way. I first thought of that, but there are plent of hash decrypters. Infact, I think you should encrypt it yourself

I got the awesome idea.

If someone manages to get to the project, create a hidden sprite, and put all the decrypting stuff there, that way, it would be almost impossible to decrypt.

Servine, if you hash using a salt, it's near impossible to decrypt if you hide the salt (as I plan to do)

Well just saying. Its much easier to just encrypt it yourself.


http://bluetetrarpg.x10.mx/usercard/?name=Servine

Offline

 

#17 2012-01-15 15:09:30

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

Re: Hashing?

Servine wrote:

SeptimusHeap wrote:

Servine wrote:


Hashing isnt the best way. I first thought of that, but there are plent of hash decrypters. Infact, I think you should encrypt it yourself

I got the awesome idea.

If someone manages to get to the project, create a hidden sprite, and put all the decrypting stuff there, that way, it would be almost impossible to decrypt.

Servine, if you hash using a salt, it's near impossible to decrypt if you hide the salt (as I plan to do)

Well just saying. Its much easier to just encrypt it yourself.

hmm

Bobby? nxIII? Can someone help me?


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

Offline

 

#18 2012-01-15 16:32:26

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

Re: Hashing?

Cryptographic hashes (such as SHA-512) are completely irreversible methods.

For example you have no way of knowing (except by randomly hashing things until you get the same hash as me - still not completely guarenteed to be my thing although most likely) what the hash was created from.

For example, try and find out what this hash is.

90826c19fd410c7a0460486936da33f62e2c75107df43954f96722e30b3449a0e5f51bb6a635776b3e38bc7a040b0d4c97507f3678709693f1536e6b123f03ba

It is a SHA-512 hash in hexadecimal form.


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

Offline

 

#19 2012-01-15 17:31:48

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

Re: Hashing?

@rookwood101
Thanks for clearing it up for him. Perhaps I'm just not a good explainer.


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

Offline

 

#20 2012-01-15 18:14:55

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

Re: Hashing?

rookwood101 wrote:

Cryptographic hashes (such as SHA-512) are completely irreversible methods.

For example you have no way of knowing (except by randomly hashing things until you get the same hash as me - still not completely guarenteed to be my thing although most likely) what the hash was created from.

For example, try and find out what this hash is.

90826c19fd410c7a0460486936da33f62e2c75107df43954f96722e30b3449a0e5f51bb6a635776b3e38bc7a040b0d4c97507f3678709693f1536e6b123f03ba

It is a SHA-512 hash in hexadecimal form.

I know. That's the point.

This is what I want:

Say user Steve makes an account on my program with inputs:
Username: "Steven6"
Password: "Ilovefido"

My program will create a random salt, for Steve it's "ug78al". How would I hash "Ilovefido" in Scratch using the salt "ug78al"? I know how to place the salt in the final product so that it can be accessed by my client while looking innocent, but how exactly do I hash the original password with the salt?


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

Offline

 

#21 2012-01-15 21:15:38

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

Re: Hashing?

Sorry about my lack of knowledge in the field, guys. Could anyone explain it in terms that I would understand? I have very little knowledge in the field of data storage and the like. I really only understand the salt part.


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

Offline

 

#22 2012-01-15 21:43:18

veggieman
Scratcher
Registered: 2011-08-12
Posts: 100+

Re: Hashing?

Servine wrote:

SeptimusHeap wrote:

Servine wrote:

Hashing isnt the best way. I first thought of that, but there are plent of hash decrypters. Infact, I think you should encrypt it yourself

I got the awesome idea.

If someone manages to get to the project, create a hidden sprite, and put all the decrypting stuff there, that way, it would be almost impossible to decrypt.

Servine, if you hash using a salt, it's near impossible to decrypt if you hide the salt (as I plan to do)

Well just saying. Its much easier to just encrypt it yourself.

It's easier, but not secure


Some days, I wish that my posts would stop disappearing

Offline

 

#23 2012-01-16 05:35:24

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

Re: Hashing?

SeptimusHeap wrote:

Say user Steve makes an account on my program with inputs:
Username: "Steven6"
Password: "Ilovefido"

My program will create a random salt, for Steve it's "ug78al". How would I hash "Ilovefido" in Scratch using the salt "ug78al"? I know how to place the salt in the final product so that it can be accessed by my client while looking innocent, but how exactly do I hash the original password with the salt?

Normally, you combine the password with the salt and then pass them together to the hashing algorithm. For example, in Python:

Code:

>>> from hashlib import md5
>>> password = "Ilovefido"
>>> salt = "ug78al"
>>> md5(password + salt).hexdigest()
'fea0f1f6fede90bd0a925b4194deac11'

For the hash to be useful, you need to have the salt as well (I assume you know this already; but for example: you might store the hash inside a PHP file that checks the user's password against a database. The password + salt is hashed, and the hash is stored in the database, not the plaintext password. If an attacker finds out the salt, then brute-forcing the hashes becomes much easier.)

The hard part in Scratch is the hashing function itself, such as MD5. From what I understand, you're trying to implement a hashing algorithm inside Scratch, which could be very difficult, unless you mod Scratch (you could create an MD5 block!  big_smile )

Bobbybee's letter to binary that he mentioned might be a good start.

Have a look at this — it seems to have a good explanation, and might have some simple hash functions you can use.

Hope some of that helps!  smile


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

Offline

 

#24 2012-01-16 06:23:16

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

Re: Hashing?

Somebody understands what I was trying to teach him....


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

Offline

 

#25 2012-01-16 07:13:18

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

Re: Hashing?

Here you go! I made a little simple rotating hash algorithm in BYOB, based off the article I found. I'm sure you could do it in normal Scratch, too; it'd just take longer to code.  tongue

Here's the BYOB file, and screenshots of the hashing algorithm and the  xor functionsmile

(Just to warn you; it is a little slow, and I expect it would be slightly slower still in Scratch, despite it being the "simplest acceptable algorithm", according to that article.)

Hope that helps!  big_smile

Last edited by blob8108 (2012-01-16 07:14:24)


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

Offline

 

Board footer