Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I generate a SHA1 in Perl or PHP?

Tags:

php

hex

perl

sha1

Verotel requires some data to be hashed with sha1_hex function. What exactly is it? No info about it in the whole internet. They say "SHA-1 hash is used (hexadecimal output)". Sha1 with hex output?

Heres one example which I can't seem to reproduce:

sha1_hex("abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1")

= 04d87d2718767ea0bef259c436ec63e3cde05be2

like image 372
user781655 Avatar asked Nov 29 '22 18:11

user781655


1 Answers

echo sha1('abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1');

Actually, that sha1_hex is named sha1() in php. Here is an example, working on your input: http://codepad.org/9fLlr9VJ

like image 118
Gabi Purcaru Avatar answered Dec 14 '22 21:12

Gabi Purcaru