1

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!

pagex
  • 41
  • 1

1 Answers1

2
<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()

Henry
  • 32,689
  • 19
  • 120
  • 221