MacSink class abstract

A sink for calculating a Mac.

Example

import 'package:cryptography/cryptography.dart';

void main() {
  final secretKey = SecretKey([1,2,3]);

  // Create a sink
  final sink = Hmac(sha256).newSink(
    secretKey: secretKey,
  );

  // Add chunks of data
  sink.add([4,5,6]);
  sink.add([7,8]);

  // Close
  sink.close();

  // We now have a MAC
  final mac = sink.mac;

  print('MAC: ${mac.bytes');
}
Inheritance
Implementers

Constructors

MacSink()

Properties

hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the sink is closed.
no setter
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 to this.
inherited
close() → void
Closes the sink.
override
mac() Future<Mac>
Calculates current MAC.
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