Updated PHP Windows builds for Brotli security fix

sodium_crypto_pwhash_scryptsalsa208sha256_str

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_pwhash_scryptsalsa208sha256_str — Get an ASCII encoded hash

Açıklama

function sodium_crypto_pwhash_scryptsalsa208sha256_str(#[\SensitiveParameter] string $password, int $opslimit, int $memlimit): string

Uyarı

Bu işlev hala belgelendirilmemiştir; sadece bağımsız değişken listesi mevcuttur.

Bağımsız Değişkenler

password

opslimit

memlimit

Dönen Değerler

+add a note

User Contributed Notes 2 notes

up
1
spam at tonycast dot com
8 years ago
<?php
/* Example Hash Generation */

    const PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE = 534288;
    const PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE = 16777216;
    const PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE = 33554432;
    const PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE = 1073741824;

$hash_str = sodium_crypto_pwhash_scryptsalsa208sha256_str('password123', PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE, PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE);

print_r($hash_str);

//outputs:  $7$C6..../....ZwhNJoHcE/5yzM05gk67R2IOAp9XjD3X2gTNRpUlg92$YBwEfrN19OUo9dZG7LPSanCmjwYg.JgOEN4E75qrXG6
up
0
sebbu at yahoo dot fr
11 hours ago
Beware that the generated hash can only be verified with sodium_crypto_pwhash_scryptsalsa208sha256_str_verify and can't be generated identically with sodium_crypto_pwhash_scryptsalsa208sha256, even with the same salt.

This function encodes the salt, then uses that encoded salt instead of the original salt.

php-scrypt with the encoded salt as parameter is able to reproduce the hash.
To Top