PHP için SHA-512 kütüphane

2 Cevap php

Ben SHA-512 karma sağlayan herhangi bir kripto kütüphanesi için arıyorum. Ben SHA-512, ancak bazı bulundu etrafında Googling yoktur.

Lütfen öneririz.

2 Cevap

PHP> = 5.3 kullanıyorsanız, işlev openssl_digest hile yapmak gerekir:

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

bana bu çıktıyı verir (splitted in two lines to get better readibility):

416b1861951170e1f6eb6543b0dd3d4f1994ce8da7cd82061513d3ddd1dd81111
f4ada5caf6421f1d17425c6f29bdb4a95cf84df9eda4164f5a762acbb490a68

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


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

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

Bana aynı çıktıyı verir (splitted, too):

416b1861951170e1f6eb6543b0dd3d4f1994ce8da7cd82061513d3ddd1dd81111
f4ada5caf6421f1d17425c6f29bdb4a95cf84df9eda4164f5a762acbb490a68

Ve, burada, mevcut sindirimi yöntemlerinin listesini bilmek, size hash_algos kullanabilirsiniz

PHP 5> = 5.1.2, PECL hash> = 1.1:

hash('sha512', someStr);

See hash() for more information.
To see all hash algorithms available to you, try:

print_r(hash_algos());