digestBytes abstract method

Future<Uint8List> digestBytes(
  1. List<int> data
)

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

Example

import 'dart:convert' show base64, utf8;
import 'package:webcrypto/webcrypto.dart';

// Convert 'hello world' to a byte array
final bytesToHash = utf8.encode('hello world');

// Compute hash of bytesToHash with sha-256
List<int> hash = await Hash.sha256.digestBytes(bytesToHash);

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

Implementation

Future<Uint8List> digestBytes(List<int> data);