digestStream abstract method

Future<Uint8List> digestStream(
  1. Stream<List<int>> data
)

Compute a cryptographic hash-sum of data stream using this Hash.

Example

import 'dart:io' show File;
import 'dart:convert' show base64;
import 'package:webcrypto/webcrypto.dart';

// Pick a file to hash.
String fileToHash = '/etc/passwd';

// Compute hash of fileToHash with sha-256
List<int> hash;
final stream = File(fileToHash).openRead();
try {
  hash = await Hash.sha256.digestStream(stream);
} finally {
  await stream.close(); // always close the stream
}

// Print the base64 encoded hash
print(base64.encode(hash));

Implementation

Future<Uint8List> digestStream(Stream<List<int>> data);