Live data from Hacker News

Show HN: Accelerating SHA256 by 100x in Golang on ARM

blog.minio.io

41–50 of 93 posts

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#41

Did you compare performance to SHA512? Despite being a theoretically more secure/"harder" algorithm, on 64 bit platforms it can sometimes be faster than SHA256. If you don't want to use 512 bits, using 256 bits of the output of SHA512 is standardized as SHA512/256 and is considered valid/secure. (I'm unclear if this performance oddity remains true with the crypto hardware extensions being used here.)

For comparison with other checksums you should look here

https://github.com/minio/sha256-simd#comparison-to-other-has...

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#42

Earlier quoted context omitted.

What's the alternative in this case?

From a bird's eye view, adjust the compiler until it outputs the assembly you would have written. Hopefully this is done in such a way that such adjustments can be cross-beneficial across platforms, and can be easily created.

[deleted]

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#43
post #21

Earlier quoted context omitted.

My understanding is that SHA2 is fine for password storage, given a prudent number of hashing rounds.

It's fine to use a SHA2 variant HMAC in PBKDF2 with an obscene, ever-increasing number of rounds, but the scrypt paper [1] provides a detailed justification why you may want to switch to a dedicated password hashing function regardless. To quote their website [2]: "We estimate that on [circa-2009] hardware, if 5 seconds are spent computing a derived key, the cost of a hardware brute-force attack against scrypt is rou…

Almost right. bcrypt is not designed to be secure against ASICs; it requires a fixed circuit size. In fact, given that CPU acceleration is available for SHA2, I suspect that PBKDF2-SHA256 is now stronger than bcrypt based on the "if my server spends X seconds hashing this password, how much money will someone need to spend to crack it" metric.

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#44
> minio/sha256-simd.

So rather than writing your own module and a blog post bragging about it, why not just send a pull request to Golang core? There are lots of assembly code in there already dealing with special instructions on different architectures, there is nothing special about this.

Or is being a humble programmer the antithesis of startup culture?

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#46

The amount of assembly in the Go ecosystem is crazy, ~1% of the standard library is assembly. There are better ways.

Do you have a source for the 1% number?

Also I'd like to know what you would consider an appropriate amount of assembly code.

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#47

Earlier quoted context omitted.

From a bird's eye view, adjust the compiler until it outputs the assembly you would have written. Hopefully this is done in such a way that such adjustments can be cross-beneficial across platforms, and can be easily created.

That's wishful thinking. GCC isn't able to do that with C language, a 20 years old compiler with a 40 years language. How would a compiler know that you can use a SHA2 instruction? Yes, there are intrinsics but then what about specialized vectorized instructions which don't match any primitive types or operations in the language (like, you can't express "add with carry" in C or Go)? And how can you explain a compiler…

"That's wishful thinking. GCC isn't able to do that with C language, a 20 years old compiler with a 40 years language. How would a compiler know that you can use a SHA2 instruction?"

Well, actually, they could, it's just not worth pattern matching because it occurs so infrequently.

"but history has shown that things like autovectorization are too fragile and can't be relied upon."

Errr, i'd say the opposite. History has shown that good autovectorizing compilers can come pretty damn close to whatever you want.

Usually the only issue is that they may insert too many runtime checks, and that's easily solvable.

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#48
post #44

> minio/sha256-simd. So rather than writing your own module and a blog post bragging about it, why not just send a pull request to Golang core? There are lots of assembly code in there already dealing with special instructions on different architectures, there is nothing special about this. Or is being a humble programmer the antithesis of startup culture?

We're not supposed to write comments like this on "Show HN" posts. This is Apache-licensed open source code. You can criticize it on its own terms, but tendentious criticisms of the motivations of its authors are off-topic for Show HN. The rule can/should be boiled down to: "First, respect new work."

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#49
post #44

> minio/sha256-simd. So rather than writing your own module and a blog post bragging about it, why not just send a pull request to Golang core? There are lots of assembly code in there already dealing with special instructions on different architectures, there is nothing special about this. Or is being a humble programmer the antithesis of startup culture?

Or you could just kindly nudge him into opening a pull request. He's probably never done it before.

Re: Show HN: Accelerating SHA256 by 100x in Golang on ARM

#50
post #44

> minio/sha256-simd. So rather than writing your own module and a blog post bragging about it, why not just send a pull request to Golang core? There are lots of assembly code in there already dealing with special instructions on different architectures, there is nothing special about this. Or is being a humble programmer the antithesis of startup culture?

Considering their code is licensed under Apache 2.0, you could do that yourself, if that's what you think is the right thing to do.

I don't see anything wrong with Minio writing a blog post to show off something neat they did.

Also, considering how ubiquitous both hashing and ARM have become, 100x is a pretty valuable speedup.

Post reply on HN