Skip to content

Commit c9ce261

Browse files
committed
slight adjustment to hashing
1 parent 3c13945 commit c9ce261

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Illuminate/Cookie/Middleware/EncryptCookies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function decrypt(Request $request)
8383
$value = $this->decryptCookie($key, $cookie);
8484

8585
$request->cookies->set(
86-
$key, strpos($value, sha1($key.'v2').'|') !== 0 ? null : substr($value, 41)
86+
$key, strpos($value, hash_hmac('sha1', $key.'v2', $this->encrypter->getKey()).'|') !== 0 ? null : substr($value, 41)
8787
);
8888
} catch (DecryptException $e) {
8989
$request->cookies->set($key, null);

src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ protected function prepareCookiesForRequest()
561561
}
562562

563563
return collect($this->defaultCookies)->map(function ($value, $key) {
564-
return encrypt(sha1($key.'v2').'|'.$value, false);
564+
return encrypt(hash_hmac('sha1', $key.'v2', base64_decode(substr(config('app.key'), 7))).'|'.$value, false);
565565
})->merge($this->unencryptedCookies)->all();
566566
}
567567

0 commit comments

Comments
 (0)