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

Unified Diff: chrome/common/random.cc

Issue 6873156: Move crypto_helpers from sync to base (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Follow bbretw review Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/random.h ('k') | chrome/common/random_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/random.cc
diff --git a/chrome/common/random.cc b/chrome/common/random.cc
new file mode 100644
index 0000000000000000000000000000000000000000..303d296ca6c5dc7e3672035115834c0932af21a6
--- /dev/null
+++ b/chrome/common/random.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2011 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 "chrome/common/random.h"
+
+#include <string>
+
+#include "base/base64.h"
+#include "base/rand_util.h"
+
+std::string Generate128BitRandomBase64String() {
+ const int kNumberBytes = 128 / 8;
+ std::string base64_encoded_bytes;
+ base::Base64Encode(base::RandBytesAsString(kNumberBytes),
+ &base64_encoded_bytes);
+ return base64_encoded_bytes;
+}
« no previous file with comments | « chrome/common/random.h ('k') | chrome/common/random_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698