2. The epoch is GMT and using the ColdFusion now() function returns local time, not GMT. This is a more accurate epoch value: left(GetTickCount(), 10)
On Fri, Jan 16, 2015 at 1:04 PM, Jon Clausen <[email protected]> wrote: > > 1) No, that wonât work. toBase64(hash('testing', "SHA-256")) gets you > close but hash_hmac is a very specific PHP function in what it does. Is > there a way you can use a different method to generate that signature or > are you trying to maintain backward compatibility? > > Alternately, hereâs a UDF designed to emulate that function: > > http://www.isummation.com/blog/calculate-hmac-sha256-digest-using-user-defined-function-in-coldfusion/ > > > 2) No, time() in PHP returns a unix timestamp. You want: > > DateDiff("s", CreateDate(1970,1,1), Now()) > > > > On Jan 16, 2015, at 9:39 AM, Robert Harrison <[email protected]> wrote: > > > > > > I have an API I need to work with. No problem converting most to > ColdFusion, > > but two strings I'm unsure of: > > > > > > > > 1. The PHP encode format is: > > > > > > > > $signature = base64_encode(hash_hmac('sha256', $mystring, true)); > > > > > > > > I think in CF the equivalent would be: > > > > > > > > <cfset signature=hash(mystring, "SHA-256", > > "Base64")> > > > > > > > > 2. The other part is : > > > > > > > > $ts=time(); > > > > > > > > Not sure what format the above outputs. Could it be the > > same as: > > > > > > > > <cfset ts=now()> > > > > > > > > Any thoughts? > > > > > > > > Thanks > > > > > > > > > > > > > > > > Robert Harrison > > Full Stack Developer > > AIMG > > <mailto:[email protected]> [email protected] > > Main Office: 704-321-1234 ext.121 > > Direct Line: 516-302-4345 > > <http://www.aimg.com/> www.aimg.com > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359982 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

