sha256 constant

Hash const sha256

SHA-256 as specified in FIPS PUB 180-4.

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

static const Hash sha256 = impl.sha256;