public static function generateHash($secret, $toHash = null)
    {
        if ($toHash === null) {
            return sha1($secret);
        }

        //first pass hashes the String of required fields
        $toHashFirstPass = sha1($toHash);

        //second pass takes the first hash, adds the secret and hashes again
        $toHashSecondPass = $toHashFirstPass . '.' . $secret;

        return sha1($toHashSecondPass);
    }