Verotel需要使用sha1_hex函数对一些数据进行散列.究竟是什么?在整个互联网上没有关于它的信息.他们说"使用SHA-1哈希(十六进制输出)".Sha1有十六进制输出?
下面是一个我似乎无法再现的例子:
sha1_hex("abc777X:description =产品的一些描述:priceAmount = 51.20:priceCurrency = EUR:shopID = 60678:version = 1")
= 04d87d2718767ea0bef259c436ec63e3cde05be2
echo sha1('abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1');
Run Code Online (Sandbox Code Playgroud)
实际上,这sha1_hex
是sha1()
在PHP中命名的.这是一个例子,处理您的输入:http://codepad.org/9fLlr9VJ
$ perl -e 'use Digest::SHA qw(sha1_hex); print sha1_hex("abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1")'
04d87d2718767ea0bef259c436ec63e3cde05be2
Run Code Online (Sandbox Code Playgroud)
在SHA-1散列产生一个20字节的输出.如果用十六进制表示这20个字节,则会得到40个字符.
对于Perl:Digest :: SHA(从Digest :: SHA1更新).
perl -MDigest::SHA=sha1_hex -le'print sha1_hex("abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1")'
04d87d2718767ea0bef259c436ec63e3cde05be2
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4962 次 |
最近记录: |