Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: packages/crypto/lib/src/digest.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/crypto/lib/crypto.dart ('k') | packages/crypto/lib/src/digest_sink.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:collection/collection.dart';
6 import 'package:convert/convert.dart';
7
8 /// A message digest as computed by a `Hash` or `HMAC` function.
9 class Digest {
10 /// The message digest as an array of bytes.
11 final List<int> bytes;
12
13 Digest(this.bytes);
14
15 /// Returns whether this is equal to another digest.
16 ///
17 /// This should be used instead of manual comparisons to avoid leaking
18 /// information via timing.
19 @override
20 bool operator ==(Object other) =>
21 other is Digest && const ListEquality().equals(bytes, other.bytes);
22
23 @override
24 int get hashCode => const ListEquality().hash(bytes);
25
26 /// The message digest as a string of hexadecimal digits.
27 @override
28 String toString() => hex.encode(bytes);
29 }
OLDNEW
« no previous file with comments | « packages/crypto/lib/crypto.dart ('k') | packages/crypto/lib/src/digest_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698