mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
a031b0fe49
This reverts commit a49e57e3
18 lines
500 B
Dart
18 lines
500 B
Dart
import 'package:bitcoin_base/bitcoin_base.dart';
|
|
import 'package:crypto/crypto.dart';
|
|
|
|
String scriptHash(String address, {required BasedUtxoNetwork network}) {
|
|
final outputScript = addressToOutputScript(address: address, network: network);
|
|
final parts = sha256.convert(outputScript).toString().split('');
|
|
var res = '';
|
|
|
|
for (var i = parts.length - 1; i >= 0; i--) {
|
|
final char = parts[i];
|
|
i--;
|
|
final nextChar = parts[i];
|
|
res += nextChar;
|
|
res += char;
|
|
}
|
|
|
|
return res;
|
|
}
|