更快的 SHA-256,MSVC 构建版

中本聪SN-1387

OpenSSL 没有提供只执行 SHA256 底层数据块哈希计算的接口。SHA256 一开始要把你的数据包进一个特殊格式的缓冲区。如果像我们这样只对一两个数据块做哈希计算,搭建缓冲区花的时间比实际哈希还长一个量级。它本来是设计给哈希几 KB、几 MB 数据时摊薄开销用的。在 BitcoinMiner 里,我们把缓冲区搭一次然后反复复用。

OpenSSL doesn't have any interface for doing just the low level raw block hash part of SHA256. SHA256 begins by wrapping your data in a specially formatted buffer. Setting up the buffer takes an order of magnitude longer than the actual hashing if you're only hashing one or two blocks like we do. It's intended that the time is amortised if you were hashing many KB or MB of data. In BitcoinMiner, we format the buffer once and keep reusing it.

如果你能找到(在 MinGW/GCC 下)比我们现有的更快的 SHA256 代码,那真是太好!(不过要留意许可证)我们现在这个是我试过的唯一一个,所以很有可能还有改进空间。

If you can find SHA256 code that's faster (with MinGW/GCC) than what we've got, that would be really great! (although, keep licensing in mind) The one we have is the only one I tried, so there's significant chance for improvement.

2 年多前我写它的时候,已有速度极快的 SHA1 实现,SHA256 却很少受到关注。这么长时间足够他们拿出更好的东西了。当时 SHA256 比最快的 SHA1 慢得超出我的预期。SHA256 应该比 SHA1 慢一些,但不该慢那么多。

When I wrote it more than 2 years ago, there were screaming hot SHA1 implementations but minimal attention to SHA256. That's a lot of time for them to come up with better stuff. SHA256 was a lot slower than the fastest SHA1 at the time than I thought it should be. Obviously SHA256 should be slower than SHA1 by a certain amount, but not by as much as I saw.

(希望你不介意我把你的主题改了名,SHA-256 优化很重要,我却老忘了这茬)

(hope you don't mind I renamed your thread, SHA-256 optimisation is something important that I keep forgetting about)

上下文
译文校对、修订与纠错

当前版本尚未建立逐条校对状态记录。来源核验、历史审校与当前译文校对是不同事项。

查看历史审校与代表修订 →

译文内容版本:08d0d398f405。用于比对文本,不代表校对等级或更新时间。

准备纠错说明

请填写对应原文、现译文、建议译法和理由。复制后通过你联系本站作者的渠道提交;此处不会自动发送。

来源
英文原标题

Faster SHA-256, MSVC build

Bitcointalk · 原始链接 ↗ 记录编号 SN-1387

阅读字号

选择适合你的字号,之后阅读会继续使用。