Skip to content

Commit

Permalink
[feature] Crypto: add hmac_sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
ogunden authored and Aqua-Ye committed Feb 2, 2012
1 parent d41e904 commit 9678424
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/crypto/bslCrypto.ml
Expand Up @@ -42,6 +42,10 @@ let base64_decode2 str =
let hmac_sha1 key text =
Cryptokit.hash_string (Cryptokit.MAC.hmac_sha1 key) text

##register hmac_sha256 : string, string -> string
let hmac_sha256 key text =
Cryptokit.hash_string (Cryptokit.MAC.hmac_sha256 key) text

##register sha2 : string -> string
let sha2 s =
let hashobj = Cryptokit.Hash.sha256 () in
Expand Down
10 changes: 10 additions & 0 deletions stdlib/crypto/crypto.opa
Expand Up @@ -54,8 +54,18 @@ Crypto = {{

Hash = {{

/**
* Produces a HMAC_SHA1 for the given key and message. The first argument
* is the key, the second is the message.
*/
hmac_sha1 = %% BslCrypto.hmac_sha1 %% : string, string -> string

/**
* Produces a HMAC_SHA256 for the given key and message. The first argument
* is the key, the second is the message.
*/
hmac_sha256 = %% BslCrypto.hmac_sha256 %% : string, string -> string

md5 = %% BslCrypto.md5 %% : string -> string

sha2 = %%BslCrypto.sha2%% : string -> string
Expand Down

0 comments on commit 9678424

Please sign in to comment.