mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-24 12:29:37 +00:00
49 lines
1.1 KiB
Dart
49 lines
1.1 KiB
Dart
/*
|
|
* This file is part of Stack Wallet.
|
|
*
|
|
* Copyright (c) 2023 Cypher Stack
|
|
* All Rights Reserved.
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
*
|
|
*/
|
|
|
|
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:dart_bs58/dart_bs58.dart';
|
|
import 'package:dart_bs58check/dart_bs58check.dart';
|
|
import 'package:hex/hex.dart';
|
|
|
|
extension Uint8ListExtensions on Uint8List {
|
|
String get toUtf8String => utf8.decode(this);
|
|
|
|
String get toHex {
|
|
return HEX.encode(this);
|
|
}
|
|
|
|
String get toBase58Encoded {
|
|
return bs58.encode(this);
|
|
}
|
|
|
|
String get toBase58CheckEncoded {
|
|
return bs58check.encode(this);
|
|
}
|
|
|
|
/// returns copy of byte list in reverse order
|
|
Uint8List get reversed {
|
|
final reversed = Uint8List(length);
|
|
for (final byte in this) {
|
|
reversed.insert(0, byte);
|
|
}
|
|
return reversed;
|
|
}
|
|
|
|
BigInt get toBigInt {
|
|
BigInt number = BigInt.zero;
|
|
for (final byte in this) {
|
|
number = (number << 8) | BigInt.from(byte & 0xff);
|
|
}
|
|
return number;
|
|
}
|
|
}
|