newHashSink method
Constructs a sink for hashing chunks.
Example
An example with Sha256:
import 'package:cryptography_plus/cryptography_plus.dart';
void main() async {
// Create a sink
final algorithm = Sha256();
final sink = algorithm.newHashSink();
// Add all parts
sink.add(<int>[1,2,3]);
sink.add(<int>[4,5]);
// Calculate hash
sink.close();
final hash = await sink.hash();
print('Hash: ${hash.bytes}');
}
Implementation
@override
DartHashSink newHashSink() {
return _DartSha256BasedState(32, _initialValues);
}