Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 #include "base/md5.h" | |
| 6 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.h" | |
|
Ilya Sherman
2015/02/10 01:31:05
nit: This include should be first.
Tim Song
2015/02/10 22:20:33
Done.
| |
| 7 | |
| 8 namespace proximity_auth { | |
| 9 | |
| 10 std::string CalculateDeviceUserId(const std::string& device_id, | |
| 11 const std::string& user_id) { | |
| 12 base::MD5Context context; | |
| 13 base::MD5Init(&context); | |
| 14 base::MD5Update(&context, device_id); | |
| 15 base::MD5Update(&context, user_id); | |
| 16 | |
| 17 base::MD5Digest digest; | |
| 18 base::MD5Final(&digest, &context); | |
| 19 return base::MD5DigestToBase16(digest); | |
|
Ilya Sherman
2015/02/10 01:31:05
MD5 is somewhat frowned upon these days, as secure
Tim Song
2015/02/10 22:20:33
I mainly did it because MD5 is fast, but I switche
Ilya Sherman
2015/02/10 23:20:14
As long as we're using SHA, why not use SHA-256, v
| |
| 20 } | |
| 21 | |
| 22 } // namespace proximity_auth | |
| OLD | NEW |