Files
PalladiumWallet/src/Core/Spv/Scripthash.cs
T
davide 3d5a226a5a docs: translate all code comments to English (language policy)
Translate every Italian /// XML doc comment, <!-- --> XAML comment, and
// inline comment to English across all source files (Core, App, tests).
Add the language policy to CLAUDE.md (conversation Italian; all code
and docs English). Update one test assertion that checked an Italian
exception message that was also translated.
2026-06-16 14:40:11 +02:00

22 lines
623 B
C#

using System.Security.Cryptography;
using NBitcoin;
namespace PalladiumWallet.Core.Spv;
/// <summary>
/// Script hash for the indexing protocol (blueprint §0/§10): SHA-256 of the
/// scriptPubKey with bytes reversed, encoded as lowercase hex.
/// </summary>
public static class Scripthash
{
public static string FromScript(Script scriptPubKey)
{
var hash = SHA256.HashData(scriptPubKey.ToBytes());
Array.Reverse(hash);
return Convert.ToHexString(hash).ToLowerInvariant();
}
public static string FromAddress(BitcoinAddress address) =>
FromScript(address.ScriptPubKey);
}