Bitcointalk · Bitcoin x86 for Windows

中本聪,2010 年 7 月 27 日

SN-1664 已核对来源,附原文与上下文。

阅读语言
中文译文

我成功把 Crypto++ 5.6.0 的 SHA256 功能集成进了 Bitcoin。这是迄今最快的 SHA256,用的是 SSE2 汇编代码。由于 Bitcoin 传给块哈希函数的是非对齐数据,我得把 MOVDQA 指令换成 MOVDQU。

我认为用 Crypto++ 5.6.0 的 SHA256 功能是当下的正路。

我把 Crypto++ 5.6.0 库的一个子集加进了 SVN。裁剪到只剩 SHA 和 11 个通用依赖文件。除了 SHA 不应该有其他密码学内容。

我把数据字段对齐了,就成功了。ASM SHA-256 快了约 48%。合计提速约为 0.3.3 版本的 2.5 倍。

我猜它用的是 SSE2。它会在编译时根据编译器环境自动设置构建配置。

看起来它在运行时有一些 SSE2 检测,但很难判断不可用时是否真的会回退。我希望发布构建带 SSE2。SSE2 从第一代 Pentium 4 就有了。Pentium 3 或更老的机器慢成那样,用它们生成纯属浪费电费。

这是 SVN rev 114。

ORIGINAL · 英文原文
I was able to integrate the SHA256 functionality from Crypto++ 5.6.0 into Bitcoin.  This is the fastest SHA256 yet using the SSE2 assembly code.  Since Bitcoin was sending unaligned data to the block hash function, I had to change the MOVDQA instruction to MOVDQU.

I think using the SHA256 functionality from Crypto++ 5.6.0 is the way forward right now.
I added a subset of the Crypto++ 5.6.0 library to the SVN.  I stripped it down to just SHA and 11 general dependency files.  There shouldn't be any other crypto in there other than SHA.

I aligned the data fields and it worked.  The ASM SHA-256 is about 48% faster.  The combined speedup is about 2.5x faster than version 0.3.3.

I guess it's using SSE2.  It automatically sets its build configuration at compile time based on the compiler environment.

It looks like it has some SSE2 detection at runtime, but it's hard to tell if it actually uses it to fall back if it's not available.  I want the release builds to have SSE2.  SSE2 has been around since the first Pentium 4.  A Pentium 3 or older would be so slow, you'd be wasting your electricity trying to generate on it anyway.

This is SVN rev 114.
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-1664