适用于PHP的SHA-512库 [英] SHA-512 library for PHP

查看:100
本文介绍了适用于PHP的SHA-512库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索提供SHA-512哈希值的任何加密货币库.我在Google上四处搜寻,但找不到SHA-512.

I am searching for any crypto library that provides SHA-512 hash. Googling around I found some but SHA-512 is absent.

请提出建议.

推荐答案

如果您使用的是PHP> = 5.3,则函数

If you are using PHP >= 5.3, the function openssl_digest should do the trick :

echo openssl_digest('glop', 'sha512');

将此输出提供给我(分为两行以获得更好的可读性):

416b1861951170e1f6eb6543b0dd3d4f1994ce8da7cd82061513d3ddd1dd81111
f4ada5caf6421f1d17425c6f29bdb4a95cf84df9eda4164f5a762acbb490a68

(而且您可以使用 以获得可用的摘要方法列表)

(And you can use openssl_get_md_methods to get the list of available digest methods)


使用PHP 5.1或5.2,您可以使用 hash 函数:


And with PHP 5.1 or 5.2, you have the hash function :

echo hash('sha512', 'glop');

给我相同的输出(也被分割):

416b1861951170e1f6eb6543b0dd3d4f1994ce8da7cd82061513d3ddd1dd81111
f4ada5caf6421f1d17425c6f29bdb4a95cf84df9eda4164f5a762acbb490a68

在这里,要了解可用摘要方法的列表,可以使用

And, here, to know the list of available digest methods, you can use hash_algos

这篇关于适用于PHP的SHA-512库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆