Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / net / websockets / websocket_handshake_challenge.cc
blob3a1c3e8adec8e2aaa2379ab206ce8de893ee90ce
1 // Copyright 2014 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 "net/websockets/websocket_handshake_challenge.h"
7 #include "base/base64.h"
8 #include "base/sha1.h"
9 #include "net/websockets/websocket_handshake_constants.h"
11 namespace net {
13 std::string ComputeSecWebSocketAccept(const std::string& key) {
14 std::string accept;
15 std::string hash = base::SHA1HashString(key + websockets::kWebSocketGuid);
16 base::Base64Encode(hash, &accept);
17 return accept;
20 } // namespace net