machine_id.h (1194B)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef RLZ_LIB_MACHINE_ID_H_ 6 #define RLZ_LIB_MACHINE_ID_H_ 7 8 #include <string> 9 #include <vector> 10 11 namespace rlz_lib { 12 13 // Gets the unique ID for the machine used for RLZ tracking purposes. On 14 // Windows, this ID is derived from the Windows machine SID, and is the string 15 // representation of a 20 byte hash + 4 bytes volum id + a 1 byte checksum. 16 // Included in financial pings with events, unless explicitly forbidden by the 17 // calling application. 18 bool GetMachineId(std::string* machine_id); 19 20 // Retrieves a raw machine identifier string and a machine-specific 21 // 4 byte value. GetMachineId() will SHA1 |data|, append |more_data|, compute 22 // the Crc8 of that, and return a hex-encoded string of that data. 23 bool GetRawMachineId(std::vector<uint8_t>* data, int* more_data); 24 25 namespace testing { 26 bool GetMachineIdImpl(const std::vector<uint8_t>& sid_bytes, 27 int volume_id, 28 std::string* machine_id); 29 } // namespace testing 30 31 } // namespace rlz_lib 32 33 #endif // RLZ_LIB_MACHINE_ID_H_