note 124003 added to function.hash-pbkdf2

From: Date: Tue, 02 Jul 2019 12:16:15 +0000
Subject: note 124003 added to function.hash-pbkdf2
Groups: php.notes 
Request: Send a blank email to php-notes+get-211461@lists.php.net to get a copy of this message
This is a very basic implementation of Rfc2898DeriveBytes class with only 2 of its constructors in case someone else finds it useful. class Rfc2898DeriveBytes { private $textToHash; private $saltByteSize; public $salt; public function __construct($arg1, $arg2) { if (is_string($arg1) && is_integer($arg2)) { $this->textToHash = $arg1; $this->saltByteSize = $arg2; $this->salt = substr( hex2bin(sha1(uniqid('', true))), 0, $this->saltByteSize ); } elseif (is_string($arg1) && is_string($arg2)) { $this->textToHash = $arg1; $this->salt = $arg2; } } public function getBytes($size) { return hash_pbkdf2( "sha1", $this->textToHash, $this->salt, 1000, $size, true ); } } ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.195 (proxied: 83.235.175.53) ---- Manual Page -- http://php.net/manual/en/function.hash-pbkdf2.php Edit -- https://master.php.net/note/edit/124003 Del: integrated -- https://master.php.net/note/delete/124003/integrated Del: useless -- https://master.php.net/note/delete/124003/useless Del: bad code -- https://master.php.net/note/delete/124003/bad+code Del: spam -- https://master.php.net/note/delete/124003/spam Del: non-english -- https://master.php.net/note/delete/124003/non-english Del: in docs -- https://master.php.net/note/delete/124003/in+docs Del: other reasons-- https://master.php.net/note/delete/124003 Reject -- https://master.php.net/note/reject/124003 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211461) next »