Index: lib/src/hmac.dart |
diff --git a/lib/src/hmac.dart b/lib/src/hmac.dart |
index f1b9de2005ca0382e1914b7a5bfcbf4f1e4be50f..f5bf6bfcd454d1d10e067a6be6036505da934612 100644 |
--- a/lib/src/hmac.dart |
+++ b/lib/src/hmac.dart |
@@ -5,8 +5,6 @@ |
import 'dart:convert'; |
import 'dart:typed_data'; |
-import 'package:typed_data/typed_data.dart'; |
- |
import 'digest.dart'; |
import 'digest_sink.dart'; |
import 'hash.dart'; |
@@ -51,75 +49,6 @@ class Hmac extends Converter<List<int>, Digest> { |
new _HmacSink(sink, _hash, _key); |
} |
-/// This is deprecated. |
-/// |
-/// Use [Hmac] instead. |
-@Deprecated("Will be removed in crypto 1.0.0.") |
-class HMAC { |
- final Hmac _hmac; |
- |
- /// The sink for implementing the deprecated APIs that involved adding data |
- /// directly to the [HMAC] instance. |
- _HmacSink _sink; |
- |
- /// The sink that [_sink] sends the [Digest] to once it finishes hashing. |
- DigestSink _innerSink; |
- |
- /// The bytes from the message so far. |
- final _message = new Uint8Buffer(); |
- |
- /// Create an [HMAC] object from a [Hash] and a binary key. |
- /// |
- /// The key should be a secret shared between the sender and receiver of the |
- /// message. |
- HMAC(Hash hash, List<int> key) : _hmac = new Hmac(hash, key) { |
- _innerSink = new DigestSink(); |
- _sink = _hmac.startChunkedConversion(_innerSink); |
- } |
- |
- void add(List<int> data) { |
- _message.addAll(data); |
- _sink.add(data); |
- } |
- |
- List<int> close() { |
- _sink.close(); |
- return _innerSink.value.bytes; |
- } |
- |
- List<int> get digest { |
- if (_sink._isClosed) return _innerSink.value.bytes; |
- |
- // This may be called at any point while the message is being hashed, but |
- // the [_HmacSink] only supports getting the value once. To make this work, |
- // we just re-hash everything after we get the digest. It's redundant, but |
- // this API is deprecated anyway. |
- _sink.close(); |
- var bytes = _innerSink.value.bytes; |
- |
- _innerSink = new DigestSink(); |
- _sink = _hmac._hash.startChunkedConversion(_innerSink); |
- _sink.add(_message); |
- |
- return bytes; |
- } |
- |
- bool verify(List<int> digest) { |
- var computedDigest = this.digest; |
- if (digest.length != computedDigest.length) { |
- throw new ArgumentError( |
- 'Invalid digest size: ${digest.length} in HMAC.verify. ' |
- 'Expected: ${_hmac._hash.blockSize}.'); |
- } |
- |
- var result = 0; |
- for (var i = 0; i < digest.length; i++) { |
- result |= digest[i] ^ computedDigest[i]; |
- } |
- return result == 0; |
- } |
-} |
- |
/// The concrete implementation of the HMAC algorithm. |
class _HmacSink extends ByteConversionSink { |
/// The sink for the outer hash computation. |