sodium_crypto_pwhash_scryptsalsa208sha256_str

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_pwhash_scryptsalsa208sha256_str获取 ASCII 编码的哈希值

描述

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

警告

此函数目前没有文档;只有其参数列表可用。

参数

password

opslimit

memlimit

返回值

添加注释

用户贡献的注释 1 个注释

spam at tonycast dot com
6 年前
<?php
/* 示例哈希生成 */

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);

// 输出:$7$C6..../....ZwhNJoHcE/5yzM05gk67R2IOAp9XjD3X2gTNRpUlg92$YBwEfrN19OUo9dZG7LPSanCmjwYg.JgOEN4E75qrXG6
To Top