Discuss Scratch

PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

I need it for future projects, since hashes are a fixed length. And? Infinite cloud data! No more having to make
definelettersstartthroughendofstrsetreporttosetitostartrepeatuntilnoti<end+1setreporttojoinreportletteriofstrchangeiby1
and a stretch-through-10-cloud-variables script!

Last edited by PenguinLover1123 (Sept. 26, 2021 14:38:57)

u7p
Scratcher
100+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

u7p wrote:

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
Then why is it used for password databases?

Scratch wiki wrote:

These kinds of encryptions, often called hashes, are widely used to securely store passwords in a database.

Last edited by PenguinLover1123 (Sept. 26, 2021 14:50:39)

dhuls
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

u7p wrote:

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
Then why is it used for password databases?

Scratch wiki wrote:

These kinds of encryptions, often called hashes, are widely used to securely store passwords in a database.
So that an attacker doesn't get the original password.
CST1229
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

dhuls wrote:

PenguinLover1123 wrote:

u7p wrote:

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
Then why is it used for password databases?

Scratch wiki wrote:

These kinds of encryptions, often called hashes, are widely used to securely store passwords in a database.
So that an attacker doesn't get the original password.
To explain it further, when creating a password, a secure website doesn't store the original password. Instead, it stores a hash (often alongside a random value used in the hashing called salt) of the password. When the user needs to authenticate, the sent password is hashed on the server (after being combined with the salt) and checked against the existing hash. If it matches, the user gets access, otherwise the user is denied access.
This way, a hacker can't get instant access to the account by getting access to the password hash database, since they would still need to find the string of characters that generates that particular hash.

Last edited by CST1229 (Sept. 26, 2021 15:35:34)

Harakou
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

u7p wrote:

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
I agree that the AT folks often talk about hashing/encryption/etc, but this sounds like it would be an otherwise normal Scratch project? The line has always been a bit fuzzy there, but I'm not sure how they'd feel about what is essentially an advanced HWS question. I can move it for now, but may move it back later.

That said, I'm not sure what exactly you're trying to accomplish here. It's true that hashes are a fixed length, but they also represent a fixed amount of information as a result. They're not meant to be reversible, either. If you wanted to encode reversible information with them, you might as well create a lookup table. The end result would be pretty much the same thing.
Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

2 best project demos for this
SHA256 Hash Generator by @kenny2scratch
Shared on June 18 2021 | Last Updated on July 18 2021
________________________________________________________________________________________________

String Hash Generator (MD5 & SHA-256) by @Nick_2440
Shared on August 3 2018 | Last Updated on April 27 2021

MD5 seems to be broken on the second project, btw.

Last edited by Chiroyce (Sept. 27, 2021 12:11:22)

Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

I need it for future projects, since hashes are a fixed length. And? Infinite cloud data! No more having to make
Ummmmmm about that - HASHES CANNOT be decoded, they can only be encoded, so no infinite cloud data!
Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

Then why is it used for password databases?
https://youtu.be/b4b8ktEV4Bg
PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

Chiroyce wrote:

PenguinLover1123 wrote:

I need it for future projects, since hashes are a fixed length. And? Infinite cloud data! No more having to make
Ummmmmm about that - HASHES CANNOT be decoded, they can only be encoded, so no infinite cloud data!
Then hashes are useless. Correct? (NO RUDENESS)
PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

Chiroyce wrote:

2 best project demos for this
SHA256 Hash Generator by @kenny2scratch (Note: PERFECT!)
Shared on June 18 2021 | Last Updated on July 18 2021
________________________________________________________________________________________________

String Hash Generator (MD5 & SHA-256) by @Nick_2440
Shared on August 3 2018 | Last Updated on April 27 2021

MD5 seems to be broken on the second project, btw.
The first one is prefect! But we will need a decoder!
PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

Harakou wrote:

u7p wrote:

Hashes and Encryption are very different, hashes are a form of data masking and cannot be reversed or “un-hashed”. I'm reporting this to be moved to advanced topics.
I agree that the AT folks often talk about hashing/encryption/etc, but this sounds like it would be an otherwise normal Scratch project? The line has always been a bit fuzzy there, but I'm not sure how they'd feel about what is essentially an advanced HWS question. I can move it for now, but may move it back later.

That said, I'm not sure what exactly you're trying to accomplish here. It's true that hashes are a fixed length, but they also represent a fixed amount of information as a result. They're not meant to be reversible, either. If you wanted to encode reversible information with them, you might as well create a lookup table. The end result would be pretty much the same thing.
A hash encoder/decoder, which means OO cloud data
Note: OO = Infinity
NFlex23
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

A hash encoder/decoder, which means OO cloud data
Note: OO = Infinity

PenguinLover1123 wrote:

The first one is prefect! But we will need a decoder!
Hashes CAN'T BE DECODED.

Last edited by NFlex23 (Sept. 27, 2021 14:39:00)

PenguinLover1123
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

NFlex23 wrote:

PenguinLover1123 wrote:

A hash encoder/decoder, which means OO cloud data
Note: OO = Infinity

PenguinLover1123 wrote:

The first one is prefect! But we will need a decoder!
Hashes CAN'T BE DECODED.
But why?
NFlex23
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

NFlex23 wrote:

PenguinLover1123 wrote:

A hash encoder/decoder, which means OO cloud data
Note: OO = Infinity

PenguinLover1123 wrote:

The first one is prefect! But we will need a decoder!
Hashes CAN'T BE DECODED.
But why?
Imagine you sha-256 hashed an entire movie, which is entirely possible. The encoded data would be only 64 characters! How on earth could you decode 64 characters to a full-length movie?

Last edited by NFlex23 (Sept. 27, 2021 15:05:31)

Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

PenguinLover1123 wrote:

But why?
1+2+3 = 6

Now if I give you ONLY the number 6, can you know what numbers I added to get 6?! Hashes are basically this, but instead of addition, it's complex math.

https://en.wikipedia.org/wiki/Hash_function

Last edited by Chiroyce (Sept. 27, 2021 15:26:16)

Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

NFlex23 wrote:

Imagine you sha-256 hashed an entire movie, which is entirely possible. The encoded data would be only 64 characters! How on earth could you decode 64 characters to a full-length movie?

I ran a SHA256 hash on the Firefox executable for macOS and what I got was this -
c08ac0e6eda8c32c4dcce2ac0467a2a2d0220cfe4f4eebfa997d13547b89edf8


HOW on earth do you manage to compress a browser into 64 bytes? That's why it's impossible to decode hashes.
imfh
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

Another explanation for why hashes can't be decoded:

How many possible hashes are there with SHA256? Answer: 256 bits = 2^256 possible hashes

How many possible 100 character long text files are there? Answer: 100 characters = 800 bits = 2^800 possible files.

2^256 is less than 2^800. There more things which are possible to hash than there are hashes which you can possible have.
(2^3 is the same thing as three 2s multiplied together, 2*2*2 = 8, if you didn't know)

In short, a given hash can represent an infinite number of values. Modern hashes try to make hard to accidentally, or even purposely, find two things with the same hash, but those two things still exist. For example, with a really bad hash algorithm, “abcd” and “1234” might have the same hash of 507974686f6e20697320636f6f6c.

Last edited by imfh (Sept. 27, 2021 18:21:10)

Chiroyce
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

imfh wrote:

Modern hashes try to make hard to accidentally find two things with the same hash, those two things still exist
Ah dang! I thought that would never happen with SHA256, is there any prize for finding a collision?
CST1229
Scratcher
1000+ posts

How to encode data into hashes (and decode the hashes) in Scratch? By hashes I mean the encryption method

imfh wrote:

Modern hashes try to make hard to accidentally find two things with the same hash, those two things still exist
I thought modern hashes try to make it hard to purposefully make two things with the same hash.

Powered by DjangoBB