doubledee Posted January 31, 2012 Share Posted January 31, 2012 What do I need to use "hash_hmac" ?? How do I get it if I don't have it?? How do I check whether I have it or not? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/ Share on other sites More sharing options...
Pikachu2000 Posted January 31, 2012 Share Posted January 31, 2012 function_exists Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312839 Share on other sites More sharing options...
scootstah Posted January 31, 2012 Share Posted January 31, 2012 Generally the manual will tell you these things. For hash_hmac, it is available since PHP 5.1.2. If you aren't running at leash 5.1.2 you could use the PECL module. Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312842 Share on other sites More sharing options...
doubledee Posted January 31, 2012 Author Share Posted January 31, 2012 function_exists Do I need hash_hmac installed on my virtual server or just hash()?? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312843 Share on other sites More sharing options...
scootstah Posted January 31, 2012 Share Posted January 31, 2012 function_exists Do I need hash_hmac installed on my virtual server or just hash()?? Debbie They are two completely different functions. EDIT: But if you have hash(), then you also have hash_hmac(). Because they are part of the same package and were introduced to PHP in the same version (5.1.2). Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312845 Share on other sites More sharing options...
doubledee Posted January 31, 2012 Author Share Posted January 31, 2012 function_exists Do I need hash_hmac installed on my virtual server or just hash()?? Debbie They are two completely different functions. EDIT: But if you have hash(), then you also have hash_hmac(). Because they are part of the same package and were introduced to PHP in the same version (5.1.2). When I look in phpinfo() I don't see hash_hmac How can I verify that I have it? I am chatting with GoDaddy and want to be sure I have it BEFORE I implement your fancy code in my other thread! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312847 Share on other sites More sharing options...
scootstah Posted January 31, 2012 Share Posted January 31, 2012 phpinfo() doesn't show every function known to PHP. Do you have "hash"? If so, that is referring to the hash package which contains hash_hmac, among other hashing functions. Once again if your PHP version is >= 5.1.2, you have hash_hmac(). Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312848 Share on other sites More sharing options...
Pikachu2000 Posted January 31, 2012 Share Posted January 31, 2012 Did you look at the manual entry for function_exists? It can't hurt to learn how to use it. Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312851 Share on other sites More sharing options...
doubledee Posted January 31, 2012 Author Share Posted January 31, 2012 phpinfo() doesn't show every function known to PHP. Do you have "hash"? If so, that is referring to the hash package which contains hash_hmac, among other hashing functions. Once again if your PHP version is >= 5.1.2, you have hash_hmac(). Okay, I thought phpinfo() showed everything. Debbie Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312853 Share on other sites More sharing options...
doubledee Posted January 31, 2012 Author Share Posted January 31, 2012 Did you look at the manual entry for function_exists? It can't hurt to learn how to use it. How about this... <?php //function_exists — Return TRUE if the given function has been defined //bool function_exists ( string $function_name ) //Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. $functionToCheck = 'hash_hmac'; if (function_exists($functionToCheck)){ echo "Function '" . $functionToCheck . "' exists."; }else{ echo "Function '" . $functionToCheck . "' does NOT exist."; } ?> Debbie Quote Link to comment https://forums.phpfreaks.com/topic/256093-hash_hmac/#findComment-1312856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.