Try this:
messageDigest = createObject("java","java.security.MessageDigest");
messageDigest = messageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(keyString.getBytes());
HTH,
--
Howie Hamlin - inFusion Project Manager
On-Line Data Solutions, Inc. - www.CoolFusion.com
inFusion Mail Server (iMS) - The Award-winning, Intelligent Mail Server
PrismAV - Virus scanning for ColdFusion and BlueDragon applications
Find out how iMS Stacks up to the competition:
http://www.coolfusion.com/imssecomparison.cfm
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
iMS-Lite - the completely free mail server solution for applications and
application servers
http://www.coolfusion.com/iMSLite
--- On Wednesday, October 05, 2005 4:27 PM, Short Fuse Media scribed: ---
>
> For some odd reason I took it upon myself to write an HMAC generator
> in cfml/java on MX 6.1 (don't ask, I'm masochistic like that) - and
> so far
> I believe I've gotten to this point:
>
> <cfscript>
> keyString = "myKey";
> dataString = "HelloWorld";
>
> messageDigest = createObject("java","java.security.MessageDigest");
> messageDigest = messageDigest.getInstance("MD5");
> messageDigest.update(keyString.getBytes());
>
> outputDigest = messageDigest.digest(dataString.getBytes("UTF-16LE"));
> </cfscript>
>
> Now, the var outputDigest gives me a byteArray, which I hit with the
> CF-Lib Bin2Hex UDF.
>
> my result is as such:
>
> b2aec7d67de6f0b74cd965a5aa87af58
>
> Now when I compare this to the old CF_HMAC tag (which works peachy,
> its
> just that I think I could do the same in 6-12 lines as opposed to a
> massive custom tag) I get the digest of:
>
> 78BD9886C78FA6D8F0C70CD943883010
>
> Clearly I'm a bit off here - anyone have any ideas?
>
> Erik Yowell
> Short Fuse Media, Inc.
> [EMAIL PROTECTED]
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220166
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54