summaryrefslogtreecommitdiff
path: root/ext/hash/hash_joaat.c
Commit message (Collapse)AuthorAgeFilesLines
* Make HashContexts serializable.Eddie Kohler2020-06-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Modify php_hash_ops to contain the algorithm name and serialize and unserialize methods. * Implement __serialize and __unserialize magic methods on HashContext. Note that serialized HashContexts are not necessarily portable between PHP versions or from architecture to architecture. (Most are, though Keccak and slow SHA3s are not.) An exception is thrown when an unsupported serialization is attempted. Because of security concerns, HASH_HMAC contexts are not currently serializable; attempting to serialize one throws an exception. Serialization exposes the state of HashContext memory, so ensure that memory is zeroed before use by allocating it with a new php_hash_alloc_context function. Performance impact is negligible. Some hash internal states have logical pointers into a buffer, or sponge, that absorbs input provided in bytes rather than chunks. The unserialize functions for these hash functions must validate that the logical pointers are all within bounds, lest future hash operations cause out-of-bounds memory accesses. * Adler32, CRC32, FNV, joaat: simple state, no buffer positions * Gost, MD2, SHA3, Snefru, Tiger, Whirlpool: buffer positions must be validated * MD4, MD5, SHA1, SHA2, haval, ripemd: buffer positions encoded bitwise, forced to within bounds on use; no need to validate
* Correct implementation of joaat hash.Eddie Kohler2020-06-221-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the result produced by a joaat hash depended on how the input data was chunked. A hash produced by multiple `hash_update` operations was incorrect. For example, this code, which should produce three identical lines: var_dump(hash("joaat", "abcd")); $hash = hash_init("joaat"); hash_update($hash, "ab"); hash_update($hash, "cd"); var_dump(hash_final($hash)); $hash = hash_init("joaat"); hash_update($hash, "abc"); hash_update($hash, "d"); var_dump(hash_final($hash)); instead produced: string(8) "cd8b6206" string(8) "e590d137" string(8) "2d59d087" This is because the finalization step, involving shift operations and adds, was applied on every chunk, rather than once at the end as is required by the hash definition. After this commit, the code above produces: string(8) "cd8b6206" string(8) "cd8b6206" string(8) "cd8b6206" as expected. Some tests encoded the wrong behavior and were corrected. Closes GH-5749
* Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | Closes GH-4732.
* Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
* Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
|
* Second round of fixing compiler warnings in ext/hash. Lots of the signatures ↵Kalle Sommer Nielsen2018-10-031-1/+1
| | | | that previously was unsigned int is now size_t, there was a fair bit of inconsistency there already and this commit should make it all sync nicely
* Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | The $Id$ keywords were used in Subversion where they can be substituted with filename, last revision number change, last changed date, and last user who changed it. In Git this functionality is different and can be done with Git attribute ident. These need to be defined manually for each file in the .gitattributes file and are afterwards replaced with 40-character hexadecimal blob object name which is based only on the particular file contents. This patch simplifies handling of $Id$ keywords by removing them since they are not used anymore.
* year++Xinchen Hui2018-01-021-1/+1
|
* Disallow non-crypto hashes in HMAC and PBKDF2Andrey Andreev2017-01-181-1/+2
| | | | For this purpose add is_crypto flag to php_hash_ops.
* Update copyright headers to 2017Sammy Kaye Powers2017-01-021-1/+1
|
* Replace usage of php_hash_uint32 and php_hash_uint64 with uint32_t and uint64_t.Rouven Weßling2016-02-041-2/+2
| | | | Remove the unused php_hash_int32 and php_hash_int64.
* Merge branch 'PHP-5.6' into PHP-7.0Lior Kaplan2016-01-011-1/+1
|\ | | | | | | | | * PHP-5.6: Happy new year (Update copyright to 2016)
| * Happy new year (Update copyright to 2016)Lior Kaplan2016-01-011-1/+1
| |
| * bump yearXinchen Hui2015-01-151-1/+1
| |
* | bump yearXinchen Hui2015-01-151-1/+1
| |
* | trailing whitespace removalStanislav Malyshev2015-01-101-1/+1
| |
* | s/PHP 5/PHP 7/Johannes Schlüter2014-09-191-1/+1
|/
* Bump yearXinchen Hui2014-01-031-1/+1
|
* Happy New YearXinchen Hui2013-01-011-1/+1
|
* - Year++Felipe Pena2012-01-011-1/+1
|
* - Year++Felipe Pena2011-01-011-1/+1
|
* JOAAT hashing now supports incremental hashing.Martin Jansen2010-03-281-3/+2
|
* - init hvalPierre Joye2010-03-251-1/+1
|
* Added Jenkins's one-at-a-time hash support to ext/hash.Martin Jansen2010-03-241-0/+100