You need "formatBaseN( )"

"Hex" is really just base 16 instead of base 10.

So... 

<cfscript>

X = 1234567891234567;
X = Ucase(FormatBaseN(x,16));


X = x & "000000000000000010"

</cfscript>

You get the idea....

-mark

Mark A. Kruger, MCSE, CFG
(402) 408-3733 ext 105
www.cfwebtools.com
www.coldfusionmuse.com
www.necfug.com


-----Original Message-----
From: megan cytron [mailto:[email protected]] 
Sent: Monday, March 15, 2010 5:34 PM
To: cf-talk
Subject: aes--any way to encrypt a hex encoded string in CF?


I am trying to match the encryption results on a box running BBj and just
can't quite get there... 

This is how they are encrypting:

1. AES/CFC/NoPadding
2. IV of zero (00000000000000000000000000000000)

Which is no problem. When encrypting 1234567891234567, I get this result:

1DF20DDA4A5C45DCD2BCDB191D08559C

They get:

1DF20DDA4A5C45DCD2BCDB191D08559CC3BF026C725CBB1C366ADEC4867917AA


The issue is that they are converting the string to hex and adding padding
and then encrypting. 

This is their hex encoded string:

3132333435363738393132333435363700000000000000000000000000000010

1234567891234567 + 15 zeroes of padding + 10--the hex value of 16, the total
number of padding bytes. 

It's no problem for me to calculate what padding is necessary, but I can't
seem to figure out any way to pass anything other than a regular string into
the encrypt tag...

Any ideas?

 






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331775
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to