Используйте hash_hmac :
hash_hmac
$sig = hash_hmac('sha256', $string, $secret)
Где $secret - ваш ключ.
$secret