TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Hashing is not encryption

153 pointsby eamannover 3 years ago

14 comments

triskaover 3 years ago
A cryptographic hash function <i>H</i> can be used for encryption though, by mimicking a one-time pad: Pick a random integer <i>k</i>, concatenate it with a secret <i>s</i>, hash the result obtaining <i>H(s•k)</i>, XOR this with the plaintext yielding the ciphertext <i>C</i> and send the pair (<i>k</i>,<i>C</i>). Pick another integer if you need to encrypt more data.<p>Decryption proceeds in the same way, <i>mutatis mutandis</i>. This is the basic idea behind one of the best currently used ciphers, ChaCha20: It builds on a hash function.<p>From a regulatory and legal perspective, this means that if you want to ban strong encryption, you must ban cryptographic hash functions.
评论 #29863349 未加载
评论 #29864579 未加载
评论 #29863273 未加载
评论 #29865551 未加载
评论 #29862331 未加载
评论 #29862707 未加载
评论 #29862462 未加载
评论 #29863338 未加载
评论 #29878114 未加载
评论 #29863493 未加载
评论 #29862300 未加载
soVeryTiredover 3 years ago
I guess the other difference between encryption and hashing is that a hash function need not be one-to-one. Many inputs can result in the same hash, though hopefully it&#x27;s hard to find collisions.<p>So a hash function is allowed to destroy information, whereas it&#x27;s pretty important that an encryption algorithm doesn&#x27;t!
评论 #29862721 未加载
评论 #29862372 未加载
13415over 3 years ago
Hashing is also not secure hashing, cryptographic hash functions are a small subset of all hash functions. I wish the author would make that clear. I&#x27;ve seen many abuses of cryptographic hash functions where ordinary (though perhaps specialized) hash functions would be more suitable.
评论 #29862428 未加载
评论 #29863012 未加载
评论 #29862812 未加载
relaunchedover 3 years ago
You&#x27;d be surprised how many people could benefit from this type of information.<p>The only thing is add is that the definition of encryption is incomplete. It seems to focus on symmetric encryption. Asymmetric encryption doesn&#x27;t require the initial encryption key to get back to the original message. Rather, it uses a key pair - one public and one private.
makachover 3 years ago
I have to admit that I was incredibly provoked by the title, then I read the article and thought &quot;this is fine&quot;. #clickbaited
mirekrusinover 3 years ago
I read about hashing, encryption and encoding and somehow at the end I want to be more vegetarian.
评论 #29864103 未加载
TorKlingbergover 3 years ago
It&#x27;s worth noting that the terminology has changed a bit over time. I.e. the old Unix C function &#x27;crypt&#x27; actually does hashing.
评论 #29863632 未加载
TacticalCoderover 3 years ago
It would be nice if TFA added at least once sentence about symmetric encryption vs asymmetric encryption.
bgroover 3 years ago
I don&#x27;t really understand the confusion around these terms in terms of day-to-day actual work. Is this really a problem? This seems like a trivial question to me so much so that I would (and have) screwed up this question in an interview which I&#x27;ll discuss here.<p>In my pedantic technical opinion (technical as in literal, not technical-interview), these are all subsets of encryption. Encryption to me is anything that scrambles the data to non-literal-plain-text in a way where you need a key to read it. These are just encryption, but the password is always just the word &quot;password&quot;, or for a specific example, the source text.<p>In my continued opinion, can&#x27;t hashes be &quot;found out&quot; in theory if you had unlimited computing time + unlimited attempts at brute force hashing every string?<p>Encoding is just encrypting the text into a non-literal-plain-text format by using (an extremely weak, known password) to translate into another (computer-readable) language. I don&#x27;t really have anything to add from the source to this one.<p>Why is my distinction about the definition of encryption important to me?<p>In my opinion, we shouldn&#x27;t limit our mind to ONLY knowing encryption as a method containing some math formula someone came up with to scramble you data based on an input password. There are a magnitude of ways to encrypt your actions in a more broad sense.<p>For example, what if you identify yourself by handing in a series of paintings to somebody (an authenticator) who physically determines your entry? He can determine if you pass by having knowledge that the order of the paintings and the artist&#x27;s initials correspond to their position in the alphabet to decrypt your ID number. (Some other tricks could be used to prevent random turn in or duplicates, such as only using a specific style of art, but I&#x27;m skipping that for this example.) Is that not an encryption method that accepts a user input and encrypts it with a black box formula to output some code?
评论 #29866440 未加载
评论 #29866191 未加载
pgCKINover 3 years ago
Funnily enough, hambuger in french is &quot;steak haché&quot; (hashed steak).
评论 #29863595 未加载
ravenstineover 3 years ago
Referring to hashing as encryption is like calling a fingerprint a lock.
throwaway984393over 3 years ago
Hashing is basically very, <i>very</i> lossy compression, while encryption is more like a jigsaw puzzle with a billion billion pieces and you hide the map of the original picture.
gitgudover 3 years ago
&gt; <i>&quot;Even if you know the algorithm and any secret keys involved, there is no way to un-hash a string. It’s an entirely destructive operation.&quot;</i><p>Hashing is similar to compressing a massive photo into a small thumbnail, it makes it easier and quicker to browse through photos, but you cannot recover the detailed resolution from the thumbnail.
评论 #29863341 未加载
yonixwover 3 years ago
If we think about it in good faith, there are some cases where hash is used for PROTECTION. Like in a password storing of hash(salt+password). So while technically correct, in the day to day language we do use hash as an encryption alternative sometimes.
评论 #29862391 未加载
评论 #29862191 未加载
评论 #29862122 未加载
评论 #29862198 未加载