function hash($str) { global $PREFS; if ($PREFS->ini('encryption_type') == 'md5') { return md5($str); } if (!function_exists('sha1')) { if (!function_exists('mhash')) { if (!class_exists('SHA')) { require PATH_CORE . 'core.sha1' . EXT; } $SH = new SHA(); return $SH->encode_hash($str); } else { return bin2hex(mhash(MHASH_SHA1, $str)); } } else { return sha1($str); } }