Skip to content

Commit

Permalink
Merge pull request #16 from randyzwitch/jq/mbed
Browse files Browse the repository at this point in the history
Switch to use MbedTLS for hmac digest
  • Loading branch information
randyzwitch authored Jan 25, 2018
2 parents e626286 + 96ab042 commit 1deaf19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
FactCheck
Nettle 0.2
MbedTLS
HTTP
6 changes: 3 additions & 3 deletions src/OAuth.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ __precompile__()

module OAuth

using HTTP, Nettle
using HTTP, MbedTLS

export
oauth_timestamp,
Expand Down Expand Up @@ -61,7 +61,7 @@ julia> oauth_sign_hmac_sha1("foo", "bar")
```
"""
function oauth_sign_hmac_sha1(message::String, signingkey::String)
base64encode(digest("sha1", signingkey, message))
base64encode(digest(MD_SHA1, signingkey, message))
end

"""
Expand Down Expand Up @@ -228,7 +228,7 @@ julia> oauth_body_hash_encode("julialang")
```
"""
function oauth_body_hash_encode(data::String)
base64encode(digest("SHA1", data))
base64encode(digest(MD_SHA1, data))
end

"""
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end

facts("oauth_sign_hmac_sha1") do
context("provides a consistent string") do
expected = "WqKCG5iyhFiES3fWYVdWJWwinaY="
expected = "dR8PcWvTl2FyvVM417iTe/p1XV8="
@fact oauth_sign_hmac_sha1("randy", "zwitch") --> expected
end
end
Expand Down

0 comments on commit 1deaf19

Please sign in to comment.