computeForDataSync static method

CID computeForDataSync(
  1. Uint8List data, {
  2. String codec = 'raw',
})

Computes CID for data (sync version).

Implementation

static CID computeForDataSync(Uint8List data, {String codec = 'raw'}) {
  final digest = sha256.convert(data);
  final mhInfo = Multihash.encode(
    'sha2-256',
    Uint8List.fromList(digest.bytes),
  );
  return CID.v1(codec, mhInfo);
}