dart_varuint_bitcoin

Creator: coderz1093

Last updated:

0 purchases

dart_varuint_bitcoin Image
dart_varuint_bitcoin Images

Languages

Categories

Add to Cart

Description:

dart varuint bitcoin

varuint-bitcoin #
encode/decode number
as bitcoin variable length integer



value
storage length (bytes)




[0, 0xfd)
1


[0xfd, 0xffff]
3


[0x010000, 0xffffffff]
5


[0x0100000000, 0x1fffffffffffff]
9



Installation #
dart pub add dart_varuint_bitcoin
copied to clipboard
Example #
import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:dart_varuint_bitcoin/dart_varuint_bitcoin.dart' as varuint;

void main() {
Uint8List buffer = Uint8List(2);
final encoded = varuint.encode(0xfc, buffer, 1);
print(hex.encode(encoded.buffer.buffer.asUint8List()));
// => 00fx

Uint8List buffer2 = Uint8List.fromList([0x00, 0xfc]);
final decoded = varuint.decode(buffer2, 1);
print(decoded.output.toRadixString(16));
// => fc
}
copied to clipboard
License #
MIT

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.