How to generate HMAC-SHA1 signature to use with WP REST API and OAuth1

I have same problem but for auto generate time and nonce you can do this:

<?php
$nonce = md5(mt_rand());
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, ['
    Authorization: OAuth oauth_consumer_key="zfksKSt8m7Bk",
    oauth_nonce=".$nonce.",
    oauth_signature="%2BOy0fDsKilNymYOOZRqjJN5q3tg%3D",
    oauth_signature_method="HMAC-SHA1",
    oauth_timestamp='.time().',
    oauth_token="IG6x6jIjboVhmyzFtjzn1fGT",
    oauth_version="1.0"
    ',
    'Content-Type: application/json; charset=utf-8',
]
);

I’m study for generate signature. I think It Can Be Useful To generate the signature using something like

$signature = hash_hmac( 'sha1', $base_string, $key );