1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-06 03:50:15 +02:00

Use crypto:hash/2 function

Use crypto:hash/2 function instead of ones from p1_sha.

This function exists since commit
erlang/otp@208f9ad382 and also implemented
as NIF, so I believe it's safe to use it.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2017-02-13 18:35:57 +03:00
parent e1ba499bd6
commit e7733ce7d9
4 changed files with 8 additions and 8 deletions

View file

@ -153,7 +153,7 @@ handshake(#ws{headers = Headers} = State) ->
[<<"Sec-Websocket-Protocol:">>, V, <<"\r\n">>]
end,
Hash = jlib:encode_base64(
p1_sha:sha1(<<Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11">>)),
crypto:hash(sha, <<Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11">>)),
{State, [<<"HTTP/1.1 101 Switching Protocols\r\n">>,
<<"Upgrade: websocket\r\n">>,
<<"Connection: Upgrade\r\n">>,