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

Side by Side Diff: src/utils/SkSHA1.h

Issue 1705583003: clean up more dead code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 10 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 | « src/utils/SkRunnable.h ('k') | src/utils/SkSHA1.cpp » ('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 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkSHA1_DEFINED
9 #define SkSHA1_DEFINED
10
11 #include "SkTypes.h"
12 #include "SkEndian.h"
13 #include "SkStream.h"
14
15 //The following macros can be defined to affect the SHA1 code generated.
16 //SK_SHA1_CLEAR_DATA causes all intermediate state to be overwritten with 0's.
17 //SK_CPU_BENDIAN allows 32 bit <=> 8 bit conversions without copies (if alligned ).
18 //SK_CPU_FAST_UNALIGNED_ACCESS allows 32 bit <=> 8 bit conversions without copie s if SK_CPU_BENDIAN.
19
20 class SkSHA1 : public SkWStream {
21 public:
22 SkSHA1();
23
24 /** Processes input, adding it to the digest.
25 * Note that this treats the buffer as a series of uint8_t values.
26 */
27 bool write(const void* buffer, size_t size) override {
28 update(reinterpret_cast<const uint8_t*>(buffer), size);
29 return true;
30 }
31
32 size_t bytesWritten() const override { return SkToSizeT(this->byteCount); }
33
34 /** Processes input, adding it to the digest. Calling this after finish is u ndefined. */
35 void update(const uint8_t* input, size_t length);
36
37 struct Digest {
38 uint8_t data[20];
39 };
40
41 /** Computes and returns the digest. */
42 void finish(Digest& digest);
43
44 private:
45 // number of bytes, modulo 2^64
46 uint64_t byteCount;
47
48 // state (ABCDE)
49 uint32_t state[5];
50
51 // input buffer
52 uint8_t buffer[64];
53 };
54
55 #endif
OLDNEW
« no previous file with comments | « src/utils/SkRunnable.h ('k') | src/utils/SkSHA1.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698