Sha hashing issue

Hi,

I am encrypting a string using the cpan Digest::sha1 module.

Its for submitting a hashDigest to a payment gateway. Trouble is, the hashDigest is not matching what the gateway says it should be and when I use the gateway company’s own site to see what the hashDigest ‘should’ be, it is different from what is being returned by Digest::sha1.

even though they both use sha1, is the perl process different from php? why else would the out put be different?

my hash returns like this - F›Šÿ…±Фû½Ä’+ʵ¯

the hash returned by their site is - a6477555e7d0d37e15e9fe73288d134b418fac8d

I would appreciate any pointer as I am pullin’ my hair out.

bazz

I seem to have resolved it using



use Digest::SHA1  qw(sha1 sha1_hex sha1_base64);
sha1_hex($hash_digest_string);

It’s a pity their docs are non-existent and their help desk replies by email anything up to 12 hours after my message to them. doesn’t make any sense for payments, imv.
bazz

The difference, PHP by default encodes the SHA1 hash into hexadecimal, instead of returning the raw binary.