Permalink
Browse files

[feature] Crypto: add hmac_sha256

  • Loading branch information...
ogunden authored and Aqua-Ye committed Jan 31, 2012
1 parent d41e904 commit 9678424ad6f07a06452b25d58893ad3eb43b81b8
Showing with 14 additions and 0 deletions.
  1. +4 −0 plugins/crypto/bslCrypto.ml
  2. +10 −0 stdlib/crypto/crypto.opa
@@ -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
View
@@ -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

0 comments on commit 9678424

Please sign in to comment.