1 // Copyright 2018 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.
5 #include "base/token.h"
9 #include "base/rand_util.h"
10 #include "base/strings/stringprintf.h"
15 Token Token::CreateRandom() {
18 // Use base::RandBytes instead of crypto::RandBytes, because crypto calls the
19 // base version directly, and to prevent the dependency from base/ to crypto/.
20 base::RandBytes(&token, sizeof(token));
24 std::string Token::ToString() const {
25 return base::StringPrintf("%016" PRIX64 "%016" PRIX64, high_, low_);