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 hash = base::SHA1HashString(key + websockets::kWebSocketGuid); 15 return base::Base64Encode(hash); 16 } 17 18 } // namespace net 19