Sha256

比特幣地址 wiki 中的 SHA256 值是否準確?

  • March 8, 2019

從 wiki 頁面<https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses> “如何創建比特幣地址”的範例顯示了 SHA256:

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

成為

600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

如果我使用這個線上工具<http://www.xorbin.com/tools/sha256-hash-calculator>

我得到:32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

我錯過了什麼嗎?

問題是您將 pubkey 視為字元串數據。您需要做的是將其視為原始二進制十六進制。如果您使用fileformat.info並使用二進制雜湊十六進製字節計算它,您確實會得到600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408.

Bitcoin-Explorer可以輕鬆處理 ASCII 編碼的十六進製字元串。以下內容正確地重新創建了en.bitcoin.it的結果:

% echo -n 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx base16-decode | shasum -a 256 600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408 -

% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256

600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408

% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256 | bx ripemd160 | bx base58check-encode -v 0

16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM

% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx ec-to-address -v 0 16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM

引用自:https://bitcoin.stackexchange.com/questions/43554