I have tried to encrypt the some string using sha-1 in coldfusion 10 and php.
coldfusion code:
<cfsavecontent variable="Mydata">
abcdefghijklmn
</cfsavecontent>
<cfset data = Hash(Mydata,"sha-1") >
<cfdump var="#data#" abort="true"/>
Coldfusion OutPut: 113D1951E36C83FE1F60BF3BC520CEF65E0373BE
PHP code:
$content_digest = sha1('abcdefghijklmn');
var_dump($content_digest);
exit();
PHP OutPut: 85d7c5ff403abe72df5b8a2708821ee33cd0bcce
Both code didn't produce the same output.
And I have tried online tool for SHA-1 http://www.freeformatter.com/sha1-generator.html#ad-output
Site OutPut: 85d7c5ff403abe72df5b8a2708821ee33cd0bcce
That site and php code are produce the same output.
Anyone explain please what is going wrong in my cf code? Thank you.
<cfsavecontent>
introduced some extra whitespaces.
So just use
<cfset data = Hash('abcdefghijklmn',"sha-1")>
Run it yourself: http://trycf.com/gist/21e6b5b1ee87f858b913/acf