Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

80%
+6 −0
Q&A What is the difference between hashing and encryption?

What specific algorithm makes it possible to scramble data into an unrecoverable form, yet still be usable for its intended purpose? It isn't any one specific algorithm. There are many differe...

posted 3mo ago by manassehkatz‭

Answer
#1: Initial revision by user avatar manassehkatz‭ · 2024-02-13T21:50:26Z (3 months ago)
> What specific algorithm makes it possible to scramble data into an unrecoverable form, yet still be usable for its intended purpose?

It isn't any one specific algorithm. There are *many* different algorithms both for hashing and for encryption. 

> Is it something like a checksum, in which a function can be applied to a hash to validate something about it, while making it impossible to forge an unauthorized piece of hashed data?

Actually, the hash itself is *something like a checksum*. Typical usage is to perform the hash function on the original data (e.g., a password) and save the result. Then on next login the user enters the password and the same function is run and the results are compared. This is better than storing the password because if someone broke into the database they would not get the password, just the hash result. In this particular case, there is no need to retrieve the original value - in fact, ability to retrieve the original value would make the database more vulnerable.

One additional advantage of hashing is *size*. If you *encrypt* a megabyte of data you will need (more or less) a megabyte to store the result. If you *hash* a megabyte of data you need some much smaller size, perhaps 256 or 512 bits (32 or 64 bytes). Hashing a large amount of data does no good if you want to retrieve it, but it can be used to *verify* things, much like a checksum. If you have a large amount of data and a good hash function, you can transmit the data and the hash value separately and then perform the hash again at the destination to verify that the data is valid. A common example of this is MD5. MD5 is often referred to as a checksum, but is really a hash function.