• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
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 "crypto/random.h"
6 
7 #include <stddef.h>
8 
9 #include <vector>
10 
11 #include "base/rand_util.h"
12 
13 namespace crypto {
14 
RandBytes(base::span<uint8_t> bytes)15 void RandBytes(base::span<uint8_t> bytes) {
16   // base::RandBytes() is already strongly random, so this is just an alias for
17   // it. If base needs a non-strong RNG function in the future, it will get a
18   // different name.
19   base::RandBytes(bytes);
20 }
21 
RandBytesAsVector(size_t length)22 std::vector<uint8_t> RandBytesAsVector(size_t length) {
23   std::vector<uint8_t> result(length);
24   RandBytes(result);
25   return result;
26 }
27 
28 }  // namespace crypto
29