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

Side by Side Diff: remoting/host/host_secret.cc

Issue 16181013: Use a direct include of strings headers in remoting/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/host_port_allocator.cc ('k') | remoting/host/ipc_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "remoting/host/host_secret.h" 5 #include "remoting/host/host_secret.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 namespace { 15 namespace {
16 16
17 // 5 digits means 100K possible host secrets with uniform distribution, which 17 // 5 digits means 100K possible host secrets with uniform distribution, which
18 // should be enough for short-term passwords, given that we rate-limit guesses 18 // should be enough for short-term passwords, given that we rate-limit guesses
19 // in the cloud and expire access codes after a small number of attempts. 19 // in the cloud and expire access codes after a small number of attempts.
20 const int kHostSecretLength = 5; 20 const int kHostSecretLength = 5;
21 const char kHostSecretAlphabet[] = "0123456789"; 21 const char kHostSecretAlphabet[] = "0123456789";
(...skipping 11 matching lines...) Expand all
33 std::string result; 33 std::string result;
34 int alphabet_size = strlen(kHostSecretAlphabet); 34 int alphabet_size = strlen(kHostSecretAlphabet);
35 result.resize(kHostSecretLength); 35 result.resize(kHostSecretLength);
36 for (int i = 0; i < kHostSecretLength; ++i) { 36 for (int i = 0; i < kHostSecretLength; ++i) {
37 result[i] = kHostSecretAlphabet[CryptoRandomInt(alphabet_size)]; 37 result[i] = kHostSecretAlphabet[CryptoRandomInt(alphabet_size)];
38 } 38 }
39 return result; 39 return result;
40 } 40 }
41 41
42 } // namespace remoting 42 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_port_allocator.cc ('k') | remoting/host/ipc_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698