History log of /PHP-8.1/ext/hash/hash.c (Results 1 – 25 of 197)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 10f5a06d 12-Sep-2023 Max Semenik

Fix GH-12186: segfault copying/cloning a finalized HashContext

Closes GH-12186.
Closes GH-12187.


# 7cae6eb8 17-Jul-2023 Ilija Tovilo

Fix hash_pbkdf2 options parameter

The value needs to be initialized to NULL as it is optional. Furthermore, the
parameter was completely missing in the stub signature.

Closes GH

Fix hash_pbkdf2 options parameter

The value needs to be initialized to NULL as it is optional. Furthermore, the
parameter was completely missing in the stub signature.

Closes GH-11731

show more ...


# baa07f3d 06-May-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11180: hash_file() appears to be restricted to 3 arguments

Closes GH-11198.


Revision tags: php-8.1.7RC1
# 187f5a36 05-Apr-2022 Christoph M. Becker

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
Fix #81714: segfault when serializing finalized HashContext


# c2eafc29 29-Mar-2022 Christoph M. Becker

Fix #81714: segfault when serializing finalized HashContext

We must not allow to serialize already finalized `HashContext`s, since
the internal context is already freed. Since there is

Fix #81714: segfault when serializing finalized HashContext

We must not allow to serialize already finalized `HashContext`s, since
the internal context is already freed. Since there is not much point
in serializing finalized `HashContext`s, we just bail out in that case.

Closes GH-8265.

show more ...

Revision tags: php-8.1.4RC1, php-8.1.3, php-8.1.2RC1, php-8.1.0, php-7.3.33, php-7.3.32, php-7.3.31, php-7.3.30, php-7.3.29
# 050e13c5 09-Jun-2021 Nikita Popov

Use free_obj handler in HashContext

Instead of dtor_obj.

# 01b3fc03 06-May-2021 KsaR

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |

show more ...

Revision tags: php-7.3.28
# 98fb565c 05-Feb-2021 Máté Kocsis

Generate class entries from stubs for another batch of extensions

Closes GH-6669

Revision tags: php-7.3.27
# 3e01f5af 15-Jan-2021 Nikita Popov

Replace zend_bool uses with bool

We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool

Replace zend_bool uses with bool

We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.

show more ...

Revision tags: php-7.3.26, php-7.3.26RC1
# 23590f7c 13-Dec-2020 Anatol Belski

hash: Implement xxHash

The implementation bundles the xxHash v0.8.0 release and includes all the variants

- xxh32, 32-bit wide
- xxh64, 64-bit wide
- xxh3, 64-bit wide
-

hash: Implement xxHash

The implementation bundles the xxHash v0.8.0 release and includes all the variants

- xxh32, 32-bit wide
- xxh64, 64-bit wide
- xxh3, 64-bit wide
- xxh128, 128-bit wide

An initial hash state can be passed through the options arrray. An additional
functionality not targeted in this implementation is the secret support in xxh3
and xxh128. That can be added at a later point.

The serialization for xxh3 and xxh128 should not be implemented, as the
state would contain the secret. Despite the xxHash is a non crypto
algorithm, the secret would be serialized as plain text which would be
insecure.

Closes GH-6524

Signed-off-by: Anatol Belski <ab@php.net>

show more ...

Revision tags: php-7.3.25, php-7.3.25RC1
# 110b4e90 02-Nov-2020 Anatol Belski

hash: Support custom algo parameters

The concrete need on this change is to support passing an initial seed
to the murmur hash. Passing a custom seed is important in terms of
randomi

hash: Support custom algo parameters

The concrete need on this change is to support passing an initial seed
to the murmur hash. Passing a custom seed is important in terms of
randomizing the hash function.

The suggested implementation adds a HashTable parameter to all the
init callbacks. Further on, an array with custom arguments is accepted
from `hash` or `hash_init` from the user land. Currently several things
like `hash_hkdf` are not touched, as they don't need passing custom
args.

Some convenience macros have been added to the SHA/MD families of
functions, so the consuming code doesn't have to be changed widely.

Another way to implement this is to add another type of the init that
would accept a HT with arguments. However, that would still require
touching all the context structs in all the algos. That would also
increase the size of those structs. As an init function is called just
once, the way of modifying the existing init callback has been seen
as more preferrable.

Closes GH-6400.

Signed-off-by: Anatol Belski <ab@php.net>
Co-Developed-by: Nikita Popov <nikita.ppv@googlemail.com>
Signed-off-by: Nikita Popov <nikita.ppv@googlemail.com>
Acked-by: Michael Wallner <mike@php.net>
Reviewed-by: Máté Kocsis <kocsismate@woohoolabs.com>
Reviewed-by: Eddie Kohler <ekohler@gmail.com>

show more ...

Revision tags: php-7.3.24, php-7.3.24RC1, php-7.3.23, php-7.3.23RC1, php-7.3.22
# 72e91e9f 30-Aug-2020 Anatol Belski

hash: Add MurmurHash3 with streaming support

The implementation is based on the upstream PMurHash. The following
variants are implemented

- murmur3a, 32-bit hash
- murmur3c,

hash: Add MurmurHash3 with streaming support

The implementation is based on the upstream PMurHash. The following
variants are implemented

- murmur3a, 32-bit hash
- murmur3c, 128-bit hash for x86
- murmur3f, 128-bit hash for x64

The custom seed support is not targeted by this implementation. It will
need a major change to the API, so then custom arguments can be passed
through `hash_init`. For now, the starting hash is always zero.

Fixes bug #68109, closes #6059

Signed-off-by: Anatol Belski <ab@php.net>
Co-Developed-by: Michael Wallner <mike@php.net>
Signed-off-by: Michael Wallner <mike@php.net>

show more ...

# 7e339a33 08-Sep-2020 Nikita Popov

Make null byte error a ValueError

Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do t

Make null byte error a ValueError

Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.

This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.

Closes GH-6094.

show more ...

# 736c5dca 19-Aug-2020 Dmitry Stogov

Fixed memory leak (ext/hash/tests/mhash_001.phpt failure)

Revision tags: php-7.3.22RC1
# f83368c6 13-Aug-2020 Máté Kocsis

Fix ZPP for mhash()

Closes GH-5985

Revision tags: php-7.3.21, php-7.3.21RC1, php-7.3.20
# 2b5de6f8 01-Jul-2020 Max Semenik

Remove proto comments from C files

Closes GH-5758

Revision tags: php-7.3.20RC1, php-7.3.19
# ada776c8 08-Jun-2020 Eddie Kohler

Make HashContexts serializable.

* Modify php_hash_ops to contain the algorithm name and
serialize and unserialize methods.

* Implement __serialize and __unserialize magic meth

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

show more ...

# 1e9ff7e7 22-Jun-2020 Eddie Kohler

SHA-3 Keccak_Hash: Store Keccak_HashInstance in the main context.

Previously, the Keccak_HashInstance was separately allocated.
This could cause memory leaks on errors. For instance,

SHA-3 Keccak_Hash: Store Keccak_HashInstance in the main context.

Previously, the Keccak_HashInstance was separately allocated.
This could cause memory leaks on errors. For instance,
in php_hash_do_hash_hmac, the following code cleans up after
a file read error:

if (n < 0) {
efree(context);
efree(K);
zend_string_release(digest);
RETURN_FALSE;
}

This does not call the context's hash_final operation, which
was the only way to free the separately-allocated Keccak state.

The simplest fix is simply to place the Keccak_HashInstance state
inside the context object. Then it doesn't need to be freed.

As a result, there is no need to call hash_final in the
HashContext destructor: HashContexts cannot contain internally
allocated resources.

show more ...

Revision tags: php-7.4.7RC1, php-7.3.19RC1
# 3ebce8e9 02-May-2020 Máté Kocsis

Fix UNKNOWN default values in various extensions

Closes GH-5514

Revision tags: php-7.3.18RC1
# 6111d64c 16-Apr-2020 Máté Kocsis

Improve a last couple of argument error messages

Closes GH-5404

Revision tags: php-7.2.30, php-7.3.17
# 3fe49d81 11-Apr-2020 Máté Kocsis

Generate method entries from stubs for a couple of extensions

Closes GH-5368

# 3e5fdef9 06-Apr-2020 Nikita Popov

Inline a ZEND_NUM_ARGS() variable

# 5322de1b 04-Apr-2020 Máté Kocsis

Generate functions entries from stubs for another set of extensions

Closes GH-5351

Revision tags: php-7.3.17RC1
# c5fe1a19 18-Mar-2020 Máté Kocsis

Improve error messages of ext/hash

Closes GH-5275

# d5871e26 18-Mar-2020 Máté Kocsis

Promote warnings to exceptions in ext/hash

12345678