public static function generateSign($url, $auth_token, $secret_key, $isoTime, $bodyToHash = [])
    {
        $hash = hash("sha256", "");
        if (is_array($bodyToHash)) {
            ksort($bodyToHash);
            $encoderData = json_encode($bodyToHash, JSON_UNESCAPED_SLASHES);
            $hash        = hash("sha256", $encoderData);
        }
        $stringToSign   = $url . ":" . $auth_token . ":" . $hash . ":" . $isoTime;
        $auth_signature = hash_hmac('sha256', $stringToSign, $secret_key, false);

        return $auth_signature;
    }
public static function generateSign($url, $auth_token, $secret_key, $isoTime, $bodyToHash = [])
    {
        $hash = hash("sha256", "");
        if (is_array($bodyToHash)) {
            ksort($bodyToHash);
            $encoderData = json_encode($bodyToHash, JSON_UNESCAPED_SLASHES);
            $hash        = hash("sha256", $encoderData);
        }
        $stringToSign   = $url . ":" . $auth_token . ":" . $hash . ":" . $isoTime;
        $auth_signature = hash_hmac('sha256', $stringToSign, $secret_key, false);

        return $auth_signature;
    }
public static function generateSign ( $ url , $ auth_token , $ secret_key , $ isoTime , $ bodyToHash = [ ] ) { $ hash = hash ( "sha256" , "" ) ; if ( is_array ( $ bodyToHash ) ) { ksort ( $ bodyToHash ) ; $ encoderData = json_encode ( $ bodyToHash , JSON_UNESCAPED_SLASHES ) ; $ hash = hash ( "sha256" , $ encoderData ) ; } $ stringToSign = $ url . ":" . $ auth_token . ":" . $ hash . ":" . $ isoTime ; $ auth_signature = hash_hmac ( 'sha256' , $ stringToSign , $ secret_key , false ) ; return $ auth_signature ; }
Generate Signature.

@param string $url Url yang akan disign.
@param string $auth_token string nilai token dari login.
@param string $secret_key string secretkey yang telah diberikan oleh BCA.
@param string $isoTime string Waktu ISO8601.
@param array|mixed $bodyToHash array Body yang akan dikirimkan ke Server BCA.

@return string
Generate Signature .