binary property

Uint8List get binary

Implementation

Uint8List get binary {
  Uint8List b = Uint8List(17);
  var bdata = new ByteData.view(b.buffer);
  int sds = 0;
  //b[0] = 16; //att heaeder is tis long
  Uint8List _atl = Uint8List(8)
    ..buffer.asByteData().setUint64(0, length, Endian.big);

  for (var i in _atl) {
    bdata.setUint8(sds++, i);
  }
  for (var i in HEX.decode(xxHash)) {
    bdata.setUint8(sds++, i);
  }
  //last byte 0 no cid or cid len
  return b;
  /*if (cid.isEmpty) {
    bdata.setUint8(16, 0);
    return b.sublist(0, 17);
  }
  var c = utf8.encode(cid) as Uint8List;
  bdata.setUint8(16, c.lengthInBytes);
  var wi = 17;
  for (var cc in c) {
    bdata.setUint8(wi++, cc);
  }
  return b.sublist(0, wi); */
}