HashSink class abstract
A sink for calculating Hash for long sequences.
Example
An example with Sha256:
import 'package:cryptography/cryptography.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}');
}
- Inheritance
-
- Object
- ByteConversionSink
- HashSink
- Implementers
Constructors
- HashSink()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
List< int> chunk) → void -
Adds chunked data to this sink.
override
-
addSlice(
List< int> chunk, int start, int end, bool isLast) → void -
Adds the next
chunk
tothis
.inherited -
close(
) → void -
Closes the sink.
inherited
-
hash(
) → Future< Hash> -
Result after calling
close()
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited