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

Side by Side Diff: chrome/browser/resources/cryptotoken/sha256.js

Issue 2900253006: WebUI: Fix more violations of no-extra-semi lint rule. (Closed)
Patch Set: clang-format Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // SHA256 in javascript. 5 // SHA256 in javascript.
6 // 6 //
7 // SHA256 { 7 // SHA256 {
8 // SHA256(); 8 // SHA256();
9 // void reset(); 9 // void reset();
10 // void update(byte[] data, opt_length); 10 // void update(byte[] data, opt_length);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 this._total = 0; 50 this._total = 0;
51 }; 51 };
52 52
53 /** Hash the next block of 64 bytes 53 /** Hash the next block of 64 bytes
54 * @param {Array<number>} buf A 64 byte buffer 54 * @param {Array<number>} buf A 64 byte buffer
55 */ 55 */
56 SHA256.prototype._compress = function(buf) { 56 SHA256.prototype._compress = function(buf) {
57 var W = this._W; 57 var W = this._W;
58 var k = this._k; 58 var k = this._k;
59 59
60 function _rotr(w, r) { return ((w << (32 - r)) | (w >>> r)); }; 60 function _rotr(w, r) { return ((w << (32 - r)) | (w >>> r)); }
61 61
62 // get 16 big endian words 62 // get 16 big endian words
63 for (var i = 0; i < 64; i += 4) { 63 for (var i = 0; i < 64; i += 4) {
64 var w = (buf[i] << 24) | 64 var w = (buf[i] << 24) |
65 (buf[i + 1] << 16) | 65 (buf[i + 1] << 16) |
66 (buf[i + 2] << 8) | 66 (buf[i + 2] << 8) |
67 (buf[i + 3]); 67 (buf[i + 3]);
68 W[i / 4] = w; 68 W[i / 4] = w;
69 } 69 }
70 70
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 this._compress(this._buf); 172 this._compress(this._buf);
173 173
174 var n = 0; 174 var n = 0;
175 for (var i = 0; i < 8; ++i) 175 for (var i = 0; i < 8; ++i)
176 for (var j = 24; j >= 0; j -= 8) 176 for (var j = 24; j >= 0; j -= 8)
177 digest[n++] = (this._chain[i] >> j) & 255; 177 digest[n++] = (this._chain[i] >> j) & 255;
178 178
179 return digest; 179 return digest;
180 }; 180 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698