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

Side by Side Diff: components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc

Issue 877033005: Use a stable device-user identifier for CryptAuth enrollments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698