Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
0be75fc2
Commit
0be75fc2
authored
Oct 21, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring the crypter class.
parent
49b13e69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
crypter.php
laravel/security/crypter.php
+21
-13
No files found.
laravel/security/crypter.php
View file @
0be75fc2
...
...
@@ -37,26 +37,34 @@ class Crypter {
*/
public
static
function
encrypt
(
$value
)
{
// Determine the most appropriate random number generator for the
// OS and system and environment the application is running on.
$iv
=
mcrypt_create_iv
(
static
::
iv_size
(),
static
::
randomizer
());
$value
=
mcrypt_encrypt
(
static
::
$cipher
,
static
::
key
(),
$value
,
static
::
$mode
,
$iv
);
return
base64_encode
(
$iv
.
$value
);
}
/**
* Get the random number generator appropriate for the server.
*
* There are a variety of sources to get a random number; however, not all
* of them will be available on every server. We will attempt to use the
* most secure random number generator available.
*
* @return int
*/
protected
static
function
randomizer
()
{
if
(
defined
(
'MCRYPT_DEV_URANDOM'
))
{
$randomizer
=
MCRYPT_DEV_URANDOM
;
return
MCRYPT_DEV_URANDOM
;
}
elseif
(
defined
(
'MCRYPT_DEV_RANDOM'
))
{
$randomizer
=
MCRYPT_DEV_RANDOM
;
}
else
{
$randomizer
=
MCRYPT_RAND
;
return
MCRYPT_DEV_RANDOM
;
}
$iv
=
mcrypt_create_iv
(
static
::
iv_size
(),
$randomizer
);
$value
=
mcrypt_encrypt
(
static
::
$cipher
,
static
::
key
(),
$value
,
static
::
$mode
,
$iv
);
return
base64_encode
(
$iv
.
$value
);
return
MCRYPT_RAND
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment