OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.crypto; | |
6 | |
7 class _HMAC implements HMAC { | 5 class _HMAC implements HMAC { |
8 _HMAC(Hash this._hash, List<int> this._key) : _message = []; | 6 _HMAC(Hash this._hash, List<int> this._key) : _message = []; |
9 | 7 |
10 HMAC update(List<int> data) { | 8 HMAC update(List<int> data) { |
11 _message.addAll(data); | 9 _message.addAll(data); |
12 return this; | 10 return this; |
13 } | 11 } |
14 | 12 |
15 List<int> digest() { | 13 List<int> digest() { |
16 var blockSize = _hash.blockSize; | 14 var blockSize = _hash.blockSize; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 result |= digest[i] ^ computedDigest[i]; | 61 result |= digest[i] ^ computedDigest[i]; |
64 } | 62 } |
65 return result == 0; | 63 return result == 0; |
66 } | 64 } |
67 | 65 |
68 // HMAC internal state. | 66 // HMAC internal state. |
69 Hash _hash; | 67 Hash _hash; |
70 List<int> _key; | 68 List<int> _key; |
71 List<int> _message; | 69 List<int> _message; |
72 } | 70 } |
OLD | NEW |