Skip to content

Commit

Permalink
Use generic digest implementation instead of sha1 impl copied from boost
Browse files Browse the repository at this point in the history
  • Loading branch information
pkerling committed Apr 3, 2018
1 parent 87470b7 commit 841cef4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 219 deletions.
3 changes: 1 addition & 2 deletions xbmc/network/websocket/CMakeLists.txt
Expand Up @@ -3,8 +3,7 @@ set(SOURCES WebSocket.cpp
WebSocketV13.cpp
WebSocketV8.cpp)

set(HEADERS sha1.hpp
WebSocket.h
set(HEADERS WebSocket.h
WebSocketManager.h
WebSocketV13.h
WebSocketV8.h)
Expand Down
16 changes: 6 additions & 10 deletions xbmc/network/websocket/WebSocketV8.cpp
Expand Up @@ -20,17 +20,19 @@

#include <string>
#include <sstream>
#include "sha1.hpp"

#include "WebSocketV8.h"
#include "WebSocket.h"
#include "utils/Base64.h"
#include "utils/Digest.h"
#include "utils/EndianSwap.h"
#include "utils/HttpParser.h"
#include "utils/HttpResponse.h"
#include "utils/log.h"
#include "utils/StringUtils.h"

using KODI::UTILITY::CDigest;

#define WS_HTTP_METHOD "GET"
#define WS_HTTP_TAG "HTTP/"

Expand Down Expand Up @@ -191,14 +193,8 @@ std::string CWebSocketV8::calculateKey(const std::string &key)
std::string acceptKey = key;
acceptKey.append(WS_KEY_MAGICSTRING);

boost::uuids::detail::sha1 hash;
hash.process_bytes(acceptKey.c_str(), acceptKey.size());

unsigned int digest[5];
hash.get_digest(digest);

for (unsigned int index = 0; index < 5; index++)
digest[index] = Endian_SwapBE32(digest[index]);
CDigest digest{CDigest::Type::SHA1};
digest.Update(acceptKey);

return Base64::Encode((const char*)digest, sizeof(digest));
return Base64::Encode(digest.FinalizeRaw());
}
207 changes: 0 additions & 207 deletions xbmc/network/websocket/sha1.hpp

This file was deleted.

0 comments on commit 841cef4

Please sign in to comment.