1 // Copyright 2014 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 "net/websockets/websocket_handshake_challenge.h" 6 7 #include "base/base64.h" 8 #include "base/hash/sha1.h" 9 #include "net/websockets/websocket_handshake_constants.h" 10 11 namespace net { 12 ComputeSecWebSocketAccept(const std::string & key)13std::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; 18 } 19 20 } // namespace net 21