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

Side by Side Diff: Source/wtf/SHA1.h

Issue 139193002: Declaration of sha1HashSize variable in proper file (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Giving more descriptive name to constant Created 6 years, 11 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 | « Source/modules/websockets/WebSocketHandshake.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const char* string = input.data(); 50 const char* string = input.data();
51 // Make sure that the creator of the CString didn't make the mistake 51 // Make sure that the creator of the CString didn't make the mistake
52 // of forcing length() to be the size of the buffer used to create the 52 // of forcing length() to be the size of the buffer used to create the
53 // string, prior to inserting the null terminator earlier in the 53 // string, prior to inserting the null terminator earlier in the
54 // sequence. 54 // sequence.
55 ASSERT(input.length() == strlen(string)); 55 ASSERT(input.length() == strlen(string));
56 addBytes(reinterpret_cast<const uint8_t*>(string), input.length()); 56 addBytes(reinterpret_cast<const uint8_t*>(string), input.length());
57 } 57 }
58 void addBytes(const uint8_t* input, size_t length); 58 void addBytes(const uint8_t* input, size_t length);
59 59
60 static const size_t outputSizeBytes = 20;
61
60 // computeHash has a side effect of resetting the state of the object. 62 // computeHash has a side effect of resetting the state of the object.
61 void computeHash(Vector<uint8_t, 20>&); 63 void computeHash(Vector<uint8_t, outputSizeBytes>&);
62 64
63 private: 65 private:
64 void finalize(); 66 void finalize();
65 void processBlock(); 67 void processBlock();
66 void reset(); 68 void reset();
67 69
68 uint8_t m_buffer[64]; 70 uint8_t m_buffer[64];
69 size_t m_cursor; // Number of bytes filled in m_buffer (0-64). 71 size_t m_cursor; // Number of bytes filled in m_buffer (0-64).
70 uint64_t m_totalBytes; // Number of bytes added so far. 72 uint64_t m_totalBytes; // Number of bytes added so far.
71 uint32_t m_hash[5]; 73 uint32_t m_hash[5];
72 }; 74 };
73 75
74 } // namespace WTF 76 } // namespace WTF
75 77
76 using WTF::SHA1; 78 using WTF::SHA1;
77 79
78 #endif // WTF_SHA1_h 80 #endif // WTF_SHA1_h
OLDNEW
« no previous file with comments | « Source/modules/websockets/WebSocketHandshake.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698