use LWP::UserAgent; use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); $sourcekey = 'K123456789L'; $pin = '1234'; $command = 'cc:sale'; $amount = '5.50'; $invoice = '123123'; # Generate Hash $seed = rand(); $prehash = $command . ":" . $pin . ":" . $amount . ":" . $invoice . ":" . $seed; $hash = 's/' . $seed . '/' . sha1_hex($prehash) . '/n';