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
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...
Answer
#1: Initial revision
> 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.