OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/common/random.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/base64.h" |
| 10 #include "base/rand_util.h" |
| 11 |
| 12 std::string Generate128BitRandomBase64String() { |
| 13 const int kNumberBytes = 128 / 8; |
| 14 std::string random_bytes(kNumberBytes, ' '); |
| 15 base::RandBytes(&random_bytes[0], kNumberBytes); |
| 16 std::string base64_encoded_bytes; |
| 17 base::Base64Encode(random_bytes, &base64_encoded_bytes); |
| 18 return base64_encoded_bytes; |
| 19 } |
OLD | NEW |