Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "components/cryptauth/raw_eid_generator_impl.h" | 5 #include "components/cryptauth/raw_eid_generator_impl.h" |
| 6 | 6 |
| 7 #include <cstring> | |
|
Kyle Horimoto
2017/04/28 22:19:17
Remove.
Tim Song
2017/04/29 01:07:50
Done.
| |
| 8 | |
| 7 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
| 8 #include "crypto/sha2.h" | 10 #include "crypto/sha2.h" |
| 9 | 11 |
| 10 namespace cryptauth { | 12 namespace cryptauth { |
| 11 | 13 |
| 12 const int32_t RawEidGenerator::kNumBytesInEidValue = 2; | 14 const int32_t RawEidGenerator::kNumBytesInEidValue = 2; |
| 13 | 15 |
| 14 RawEidGeneratorImpl::RawEidGeneratorImpl() {} | 16 RawEidGeneratorImpl::RawEidGeneratorImpl() {} |
| 15 | 17 |
| 16 RawEidGeneratorImpl::~RawEidGeneratorImpl() {} | 18 RawEidGeneratorImpl::~RawEidGeneratorImpl() {} |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 28 uint64_t timestamp_data = | 30 uint64_t timestamp_data = |
| 29 base::HostToNet64(static_cast<uint64_t>(start_of_period_timestamp_ms)); | 31 base::HostToNet64(static_cast<uint64_t>(start_of_period_timestamp_ms)); |
| 30 to_hash.append(reinterpret_cast<char*>(×tamp_data), sizeof(uint64_t)); | 32 to_hash.append(reinterpret_cast<char*>(×tamp_data), sizeof(uint64_t)); |
| 31 | 33 |
| 32 std::string result = crypto::SHA256HashString(to_hash); | 34 std::string result = crypto::SHA256HashString(to_hash); |
| 33 result.resize(RawEidGenerator::kNumBytesInEidValue); | 35 result.resize(RawEidGenerator::kNumBytesInEidValue); |
| 34 return result; | 36 return result; |
| 35 } | 37 } |
| 36 | 38 |
| 37 } // namespace cryptauth | 39 } // namespace cryptauth |
| OLD | NEW |