略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: sodium_crypto_pwhash_scryptsalsa208sha256_str

2024-12-22

sodium_crypto_pwhash_scryptsalsa208sha256_str

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_pwhash_scryptsalsa208sha256_strGet an ASCII encoded hash

说明

sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string

警告

本函数还未编写文档,仅有参数列表。

参数

password

opslimit

memlimit

返回值

add a noteadd a note

User Contributed Notes 1 note

up
0
spam at tonycast dot com
4 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

官方地址:https://www.php.net/manual/en/function.sodium-crypto-pwhash-scryptsalsa208sha256-str.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3