Chromium Code Reviews| Index: components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc |
| diff --git a/components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc b/components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5f31b762040a8f7a5aee0b217a89ed1eac27080c |
| --- /dev/null |
| +++ b/components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc |
| @@ -0,0 +1,22 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/md5.h" |
| +#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.
|
| + |
| +namespace proximity_auth { |
| + |
| +std::string CalculateDeviceUserId(const std::string& device_id, |
| + const std::string& user_id) { |
| + base::MD5Context context; |
| + base::MD5Init(&context); |
| + base::MD5Update(&context, device_id); |
| + base::MD5Update(&context, user_id); |
| + |
| + base::MD5Digest digest; |
| + base::MD5Final(&digest, &context); |
| + 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
|
| +} |
| + |
| +} // namespace proximity_auth |