Reputation: 41
Does anyone know the coldfusion equivelent for this php code?
$calcedVerify = sha1(mb_convert_encoding($pop, "UTF-8"));
$calcedVerify = strtoupper(substr($calcedVerify,0,8));
Thanks!
Upvotes: 1
Views: 377
Reputation: 32915
<cfset calcedVerify = Hash(pop ,"SHA-1", "UTF-8")>
<cfset calcedVerify = Left(calcedVerify, 8)>
Note: The hexadecimal hash returned is already in uppercase.
SHA-1
should be available in Standard Edition according to Adobe ColdFusion 9 Web Application Construction Kit even though the hash() doc said otherwise
substr()
~= Mid()
but CF index starts from 1 instead of 0.
strtoupper()
== ucase()
mb_convert_encoding()
~= CharsetDecode()
Upvotes: 2