From: Dario Teixeira <darioteixeira@yahoo.com>
To: caml-list@inria.fr, Sylvain Le Gall <sylvain@le-gall.net>
Subject: Re: [Caml-list] Re: Cryptokit and HMAC-SHA256
Date: Wed, 21 Jul 2010 14:22:58 -0700 (PDT) [thread overview]
Message-ID: <317672.81389.qm@web111509.mail.gq1.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 721 bytes --]
Hi,
> If you decide to code the solution and provide the patch, I will be
> happy to apply it to cryptokit (if the main author of cryptokit accepts
> it, of course).
I'm attaching the patches adding support for HMAC-SHA256 and HMAC-RIPEMD160
(I don't need the latter, but for the sake of completeness it seemed silly
not to support it as well). Note that these are *very* straightforward
patches -- kudos to Xavier for making Cryptokit so easy to extend.
The caveat is that I'm not a cryptographer. I did, however, verify that
these new HMACs pass all the test cases listed in RFC4231 (for HMAC-SHA256)
and RFC2286 (for HMAC-RIPEMD160).
Thanks for your attention!
Cheers,
Dario Teixeira
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cryptokit.mli.patch --]
[-- Type: text/x-diff; name="cryptokit.mli.patch", Size: 1205 bytes --]
--- cryptokit.mli.old 2010-07-21 22:10:37.000000000 +0100
+++ cryptokit.mli 2010-07-21 22:13:09.000000000 +0100
@@ -483,6 +483,16 @@
applied to SHA-1. The returned hash values are 160 bits (20 bytes)
long. The [key] argument is the MAC key; it can have any length,
but a minimal length of 20 bytes is recommended. *)
+ val hmac_sha256: string -> hash
+ (** [hmac_sha256 key] returns a MAC based on the HMAC construction (RFC2104)
+ applied to SHA-256. The returned hash values are 256 bits (32 bytes)
+ long. The [key] argument is the MAC key; it can have any length,
+ but a minimal length of 32 bytes is recommended. *)
+ val hmac_ripemd160: string -> hash
+ (** [hmac_ripemd160 key] returns a MAC based on the HMAC construction (RFC2104)
+ applied to RIPEMD-160. The returned hash values are 160 bits (20 bytes)
+ long. The [key] argument is the MAC key; it can have any length,
+ but a minimal length of 20 bytes is recommended. *)
val hmac_md5: string -> hash
(** [hmac_md5 key] returns a MAC based on the HMAC construction (RFC2104)
applied to MD5. The returned hash values are 128 bits (16 bytes)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: cryptokit.ml.patch --]
[-- Type: text/x-diff; name="cryptokit.ml.patch", Size: 691 bytes --]
--- cryptokit.ml.old 2010-07-21 19:33:24.000000000 +0100
+++ cryptokit.ml 2010-07-21 22:03:48.000000000 +0100
@@ -947,9 +947,13 @@
module MAC = struct
module HMAC_SHA1 = HMAC(struct class h = Hash.sha1 let blocksize = 64 end)
+module HMAC_SHA256 = HMAC(struct class h = Hash.sha256 let blocksize = 64 end)
+module HMAC_RIPEMD160 = HMAC(struct class h = Hash.ripemd160 let blocksize = 64 end)
module HMAC_MD5 = HMAC(struct class h = Hash.md5 let blocksize = 64 end)
let hmac_sha1 key = new HMAC_SHA1.hmac key
+let hmac_sha256 key = new HMAC_SHA256.hmac key
+let hmac_ripemd160 key = new HMAC_RIPEMD160.hmac key
let hmac_md5 key = new HMAC_MD5.hmac key
let aes ?iv ?pad key =
next reply other threads:[~2010-07-21 21:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 21:22 Dario Teixeira [this message]
2010-07-22 8:37 ` Goswin von Brederlow
2010-07-22 8:49 ` Sylvain Le Gall
2010-07-22 9:44 ` [Caml-list] " Dario Teixeira
2010-07-22 13:24 ` Goswin von Brederlow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=317672.81389.qm@web111509.mail.gq1.yahoo.com \
--to=darioteixeira@yahoo.com \
--cc=caml-list@inria.fr \
--cc=sylvain@le-gall.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox