Skip to content

Commit 6a34332

Browse files
committed
[#5472] Minor tweak and adding code example
1 parent c520e77 commit 6a34332

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/security/secure_tools.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ to work correctly. Just pass a file name to enable it::
5050
use Symfony\Component\Security\Core\Util\SecureRandom;
5151

5252
$generator = new SecureRandom('/some/path/to/store/the/seed.txt');
53+
5354
$random = $generator->nextBytes(10);
55+
$hashedRandom = md5($random); // see tip below
5456

5557
.. note::
5658

@@ -60,7 +62,7 @@ to work correctly. Just pass a file name to enable it::
6062
.. tip::
6163

6264
The ``nextBytes()`` method returns a binary string which may contain the
63-
``\0`` character. This can cause troubles in lots of common scenarios, such
65+
``\0`` character. This can cause trouble in several common scenarios, such
6466
as storing this value in a database or including it as part of the URL. The
6567
solution is to hash the value returned by ``nextBytes()`` (to do that, you
6668
can use a simple ``md5()`` PHP function).

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy