php-src/ext/hash
Eddie Kohler ada776c84c Make HashContexts serializable.
* 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
2020-06-30 14:30:33 +02:00
..
sha3 Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
tests Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
bench.php Apply tidy formatting 2020-02-03 13:41:31 +01:00
config.m4 Merge branch 'PHP-7.4' 2019-09-17 16:18:03 +02:00
config.w32 Sync HAVE_HASH, HAVE_HASH_EXT, PHAR_HASH_OK symbols 2019-06-27 23:25:33 +02:00
CREDITS
hash.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash.stub.php Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_adler32.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_arginfo.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_crc32.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_fnv.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_gost.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_haval.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_joaat.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_md.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_ripemd.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_sha.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_sha3.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_snefru.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_tiger.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
hash_whirlpool.c Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_adler32.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_crc32.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_crc32_tables.h Remove mention of PHP major version in Copyright headers 2019-09-25 14:51:43 +02:00
php_hash_fnv.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_gost.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_gost_tables.h Replace usage of php_hash_uint32 and php_hash_uint64 with uint32_t and uint64_t. 2016-02-04 11:57:41 +01:00
php_hash_haval.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_joaat.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_md.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_ripemd.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_sha.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_sha3.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_snefru.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_snefru_tables.h Remove mention of PHP major version in Copyright headers 2019-09-25 14:51:43 +02:00
php_hash_tiger.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_tiger_tables.h Remove mention of PHP major version in Copyright headers 2019-09-25 14:51:43 +02:00
php_hash_whirlpool.h Make HashContexts serializable. 2020-06-30 14:30:33 +02:00
php_hash_whirlpool_tables.h Remove mention of PHP major version in Copyright headers 2019-09-25 14:51:43 +02:00