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

Side by Side Diff: components/rappor/byte_vector_utils.h

Issue 1112003002: Use 64 bit shift when convert uint64_t to ByteVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 #ifndef COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_ 5 #ifndef COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_
6 #define COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_ 6 #define COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/rappor/rappor_parameters.h" 12 #include "components/rappor/rappor_parameters.h"
13 #include "crypto/hmac.h" 13 #include "crypto/hmac.h"
14 14
15 namespace rappor { 15 namespace rappor {
16 16
17 // A vector of 8-bit integers used to store a set of binary bits. 17 // A vector of 8-bit integers used to store a set of binary bits.
18 typedef std::vector<uint8_t> ByteVector; 18 typedef std::vector<uint8_t> ByteVector;
19 19
20 // Converts the lowest |size| bytes of |value| into a ByteVector.
21 void Uint64ToByteVector(uint64_t value, uint64_t size, ByteVector* output);
Alexei Svitkine (slow) 2015/04/29 15:01:07 Why is size a uint64_t? Should just be an int.
Steven Holte 2015/04/29 18:18:56 Changed to size_t
22
20 // Computes a bitwise AND of byte vectors and stores the result in rhs. 23 // Computes a bitwise AND of byte vectors and stores the result in rhs.
21 // Returns rhs for chaining. 24 // Returns rhs for chaining.
22 ByteVector* ByteVectorAnd(const ByteVector& lhs, ByteVector* rhs); 25 ByteVector* ByteVectorAnd(const ByteVector& lhs, ByteVector* rhs);
23 26
24 // Computes a bitwise OR of byte vectors and stores the result in rhs. 27 // Computes a bitwise OR of byte vectors and stores the result in rhs.
25 // Returns rhs for chaining. 28 // Returns rhs for chaining.
26 ByteVector* ByteVectorOr(const ByteVector& lhs, ByteVector* rhs); 29 ByteVector* ByteVectorOr(const ByteVector& lhs, ByteVector* rhs);
27 30
28 // Merges the contents of lhs and rhs vectors according to a mask vector. 31 // Merges the contents of lhs and rhs vectors according to a mask vector.
29 // The i-th bit of the result vector will be the i-th bit of either the lhs 32 // The i-th bit of the result vector will be the i-th bit of either the lhs
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 // Total number of bytes streamed from the HMAC_DRBG Generate Process. 110 // Total number of bytes streamed from the HMAC_DRBG Generate Process.
108 size_t generated_bytes_; 111 size_t generated_bytes_;
109 112
110 DISALLOW_ASSIGN(HmacByteVectorGenerator); 113 DISALLOW_ASSIGN(HmacByteVectorGenerator);
111 }; 114 };
112 115
113 } // namespace rappor 116 } // namespace rappor
114 117
115 #endif // COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_ 118 #endif // COMPONENTS_RAPPOR_BYTE_VECTOR_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | components/rappor/byte_vector_utils.cc » ('j') | components/rappor/byte_vector_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698