Commit 16e5820
committed
feature #52948 Use faster hashing algorithms when possible (javiereguiluz)
This PR was squashed before being merged into the 7.1 branch.
Discussion
----------
Use faster hashing algorithms when possible
| Q | A
| ------------- | ---
| Branch? | 7.1
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | -
| License | MIT
`xxh128` is 60 times faster than `sha256` (source: https://php.watch/versions/8.1/xxHash) but it's not cryptographically secure.
In previous versions we already used `xxh128` in some places. In this PR I propose to use it in all places where we don't need a cryptographically secure hash.
Comments:
* ~I also remove some `base64` encoding of binary hashes, etc. It looks convoluted and to me it looks unnecessary. But I can revert these changes if needed.~ **REVERTED**
* There are some places where we can probably use `xxh128` but I'm not sure, so I didn't. These:
* https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php#L71
* https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L421-L434
* https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L421-L434
* And there's this use case, where a function explicitly tells that we're generating a sha256 hash, so I'm not sure if changing it is a BC break: https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php#L42-L65
#SymfonyHackday
Commits
-------
3d4d3557f7 Use faster hashing algorithms when possibleFile tree
2 files changed
+2
-2
lines changed- EventListener
- Tests/DependencyInjection
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1693 | 1693 | | |
1694 | 1694 | | |
1695 | 1695 | | |
1696 | | - | |
| 1696 | + | |
1697 | 1697 | | |
1698 | 1698 | | |
1699 | 1699 | | |
| |||
0 commit comments