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..f9aafcb475a080db08b740dcdc0beb8a206817d7 |
--- /dev/null |
+++ b/components/proximity_auth/cryptauth/cryptauth_enrollment_utils.cc |
@@ -0,0 +1,20 @@ |
+// 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 "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.h" |
+ |
+#include "base/sha1.h" |
+#include "components/proximity_auth/base64url.h" |
+ |
+namespace proximity_auth { |
+ |
+std::string CalculateDeviceUserId(const std::string& device_id, |
+ const std::string& user_id) { |
+ std::string device_user_id; |
+ Base64UrlEncode(base::SHA1HashString(device_id + "|" + user_id), |
+ &device_user_id); |
+ return device_user_id; |
+} |
+ |
+} // namespace proximity_auth |