MCPcopy Create free account
hub / github.com/USBGuard/usbguard / initializeHash

Method initializeHash

src/Library/DevicePrivate.cpp:133–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 }
132
133 void DevicePrivate::initializeHash()
134 {
135 Hash hash;
136 const std::string vendor_id = _device_id.getVendorID();
137 const std::string product_id = _device_id.getProductID();
138
139 if (vendor_id.empty() || product_id.empty()) {
140 throw Exception("Device hash initialization", numberToString(getID()), "vendor and/or product id values not available");
141 }
142
143 /*
144 * Hash name, device id and serial number fields.
145 */
146 for (const std::string& field : {
147 _name, vendor_id, product_id, _serial_number
148 }) {
149 hash.update(field);
150 }
151 _hash = std::move(hash);
152 }
153
154 void DevicePrivate::updateHash(std::istream& descriptor_stream, const size_t expected_size)
155 {

Callers

nothing calls this directly

Calls 4

ExceptionFunction · 0.85
emptyMethod · 0.80
numberToStringFunction · 0.50
updateMethod · 0.45

Tested by

no test coverage detected