diff --git a/.github/workflows/Codecov.yml b/.github/workflows/Codecov.yml index 4a871bb..a83f5c0 100644 --- a/.github/workflows/Codecov.yml +++ b/.github/workflows/Codecov.yml @@ -13,8 +13,6 @@ jobs: build: uses: The-FireHub-Project/.github/.github/workflows/Codecov.yml@master with: - phpVersion: '8.5' - phpExtensions: ${{ vars.PHP_EXTENSIONS }} tools: "phpunit:13.x" suites: '["unit"]' secrets: diff --git a/.github/workflows/PHPStan.yml b/.github/workflows/PHPStan.yml index 62e061a..c553334 100644 --- a/.github/workflows/PHPStan.yml +++ b/.github/workflows/PHPStan.yml @@ -10,8 +10,6 @@ jobs: uses: The-FireHub-Project/.github/.github/workflows/RunCommandOnMatrix.yml@master with: title: "Run PHPStan" - phpVersions: ${{ vars.PHP_VERSIONS }} - phpExtensions: ${{ vars.PHP_EXTENSIONS }} tools: "phpstan:2.x" command: "phpstan analyse" secrets: diff --git a/.github/workflows/PHPUnit.yml b/.github/workflows/PHPUnit.yml index 3d8ae28..556cccb 100644 --- a/.github/workflows/PHPUnit.yml +++ b/.github/workflows/PHPUnit.yml @@ -10,8 +10,6 @@ jobs: uses: The-FireHub-Project/.github/.github/workflows/RunCommandOnMatrix.yml@master with: title: "Run PHPUnit" - phpVersions: ${{ vars.PHP_VERSIONS }} - phpExtensions: ${{ vars.PHP_EXTENSIONS }} tools: "phpunit:13.x" command: "phpunit" secrets: diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e4194..4478978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [[v0.5.2](https://github.com/The-FireHub-Project/Runtime/compare/v0.5.1...v0.5.2)] – 2026-11-06 + +### Added +* Add incremental hashing context utilities to `Hash` by @dieselxxx + # [[v0.5.1](https://github.com/The-FireHub-Project/Runtime/compare/v0.5.0...v0.5.1)] – 2026-11-04 ### Added diff --git a/README.md b/README.md index 7531916..c522a2b 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ PHP Runtime Foundation
release version @@ -22,25 +22,46 @@ /> -[![PHPStan](https://github.com/The-FireHub-Project/Runtime/actions/workflows/PHPStan.yml/badge.svg?branch=develop)](https://github.com/The-FireHub-Project/Runtime/actions/workflows/PHPStan.yml) -[![PHPUnit](https://github.com/The-FireHub-Project/Runtime/actions/workflows/PHPUnit.yml/badge.svg?branch=develop)](https://github.com/The-FireHub-Project/Runtime/actions/workflows/PHPUnit.yml) -[![Codecov](https://codecov.io/gh/The-FireHub-Project/Runtime/branch/develop/graph/badge.svg?token=XW2YEONF51)](https://app.codecov.io/gh/The-FireHub-Project/Runtime/tree/develop) -

- + + GitHub created at + GitHub last commit (branch) - + GitHub activity (branch) - + + GitHub contributors + GitHub commit difference between two branches + + GitHub top language + + GitHub repo size + + GitHub code size

@@ -54,47 +75,55 @@ Its role is to provide a consistent execution foundation between native PHP capa --- -## FireHub Icon Development Branch +## FireHub Icon Repository Purpose -⚠️ **This is the `develop` branch** +This repository provides a lightweight PHP runtime abstraction layer that wraps native PHP functionality into clean, consistent, and deterministic APIs. -- Unstable -- APIs may change without notice -- Not intended for production use +Its purpose is to reduce boilerplate and standardize common execution patterns across the FireHub ecosystem by offering ergonomic helper classes for arrays, strings, files, environment access, and other low-level runtime operations. -## FireHub Icon Branch Purpose +It is strictly focused on execution-level concerns and does not contain domain logic, business rules, or framework-level orchestration. It exists to improve developer productivity while preserving native PHP behavior and ensuring zero framework coupling. -The `develop` branch is the **primary integration branch** for all ongoing development. +## FireHub Icon Security -It serves as the staging area where: -- Feature branches are merged -- Bug fixes are integrated -- Experimental work is stabilized -- Code is prepared for upcoming releases +For security reporting and guidelines, please refer to our [SECURITY.md](https://github.com/The-FireHub-Project/.github/blob/master/.github/SECURITY.md) file. -All **release branches** are created **from `develop`**. +## FireHub Icon Community -## Stability Guarantee +![GitHub watchers](https://img.shields.io/github/watchers/The-FireHub-Project/Runtime?style=social) +![GitHub Repo stars](https://img.shields.io/github/stars/The-FireHub-Project/Runtime?style=social) +![GitHub forks](https://img.shields.io/github/forks/The-FireHub-Project/Runtime?style=social) -❌ No backward compatibility guarantee -❌ APIs may change without notice -❌ Behavior may be incomplete or inconsistent -❌ Breaking changes are expected +- Be sure to review the [Code of Conduct](https://github.com/The-FireHub-Project/.github/blob/master/.github/CODE_OF_CONDUCT.md). +- Read a [Contributing](https://github.com/The-FireHub-Project/.github/blob/master/.github/CONTRIBUTING.md) file to see how you can contribute to this project. +- Read our [Security policy](https://github.com/The-FireHub-Project/.github/blob/master/.github/SECURITY.md) file to see how you can report a vulnerability. +- Review the project [Governance model](https://github.com/The-FireHub-Project/.github/blob/master/.github/GOVERNANCE.md), including roles, decision-making, RFC process, and releases. -This branch is intended **only for contributors and advanced testers**. +## FireHub Icon Support -## FireHub Icon Composer Usage (Not Recommended) +

+ + GitHub in-progress issues + + GitHub total issues + + GitHub opened pull requests +

-For internal testing only: +For help with FireHub products, please refer to the following resources: -```json -{ - "require": { - "the-firehub-project/runtime": "dev-develop" - } -} -``` -⚠️ Never use dev-develop in production. +- **General questions & discussions**: [GitHub Discussions](https://github.com/orgs/The-FireHub-Project/discussions) +- **Bug reports & issues**: [Support](https://github.com/The-FireHub-Project/Runtime/issues) +- **Documentation & guides**: [FireHub Docs](https://the-firehub-project.github.io) +- **Commercial support** (Pro/Enterprise): contact your account manager ## FireHub Icon Authors and Contributors diff --git a/composer.json b/composer.json index 5dcdcf4..3df5a87 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,10 @@ "layer": "runtime", "edition": "standard", "role": "execution", - "criticality": "medium" + "criticality": "medium", + "ci": { + "php-versions": ["8.5"] + } } } } \ No newline at end of file diff --git a/src/Hash.php b/src/Hash.php index 33d84ef..8ade625 100644 --- a/src/Hash.php +++ b/src/Hash.php @@ -18,17 +18,21 @@ use FireHub\Runtime\Exception\ { EmptyHashKeyException, HashByteLengthException, HashIterationException }; -use SensitiveParameter, Throwable; +use HashContext, SensitiveParameter, Throwable; use function hash; use function hash_algos; +use function hash_copy; use function hash_equals; use function hash_file; +use function hash_final; use function hash_hkdf; use function hash_hmac; use function hash_hmac_algos; use function hash_hmac_file; +use function hash_init; use function hash_pbkdf2; +use function hash_update; /** * ### PHP Runtime Hash Utilities @@ -298,4 +302,78 @@ public static function pbkdf2 (Algorithm $algorithm, #[SensitiveParameter] strin } + /** + * ### Initializes an incremental hashing context + * @since 1.0.0 + * + * @param \FireHub\Runtime\Hash\Algorithm $algorithm + * Hashing algorithm. + * + * @return HashContext Initialized hashing context. + */ + public static function initialize (Algorithm $algorithm):HashContext { + + return hash_init($algorithm->value); + + } + + /** + * ### Updates an incremental hashing context + * @since 1.0.0 + * + * @param HashContext $context + * Hashing context. + * + * @param string $data + * Data to include in the hash. + * + * @return void + */ + public static function update (HashContext $context, string $data):void { + + hash_update($context, $data); + + } + + /** + * ### Copies a hashing context + * + * Creates an independent copy of an existing incremental hashing context. + * + * The copied context preserves the current hashing state and can be updated or finalized independently of the + * original context. + * @since 1.0.0 + * + * @param HashContext $context

+ * The hashing context to copy. + *

+ * + * @return \HashContext A new hashing context containing the same state. + */ + public static function copy (HashContext $context):HashContext { + + return hash_copy($context); + + } + + /** + * ### Gets the current hash digest without finalizing the context + * @since 1.0.0 + * + * @uses \FireHub\Runtime\Hash::copy() To create a copy of the context. + * + * @param HashContext $context + * Hashing context. + * + * @param bool $binary [optional] + * Whether to return the raw binary digest. + * + * @return non-empty-string Hash digest. + */ + public static function digest (HashContext $context, bool $binary = false):string { + + return hash_final(self::copy($context), $binary); + + } + } \ No newline at end of file diff --git a/tests/Unit/Date/TimezoneTest.php b/tests/Unit/Date/TimezoneTest.php index 2efdbfd..ae5f268 100644 --- a/tests/Unit/Date/TimezoneTest.php +++ b/tests/Unit/Date/TimezoneTest.php @@ -16,9 +16,8 @@ use FireHub\Testing\FireHubTestCase; use FireHub\Runtime\Date; use FireHub\Core\Type\Date\Zone; -use FireHub\Testing\DataProviders\DateDataProvider; use PHPUnit\Framework\Attributes\ { - CoversClass, DataProviderExternal, Group, Small + CoversClass, Group, Small, TestWith }; /** @@ -40,7 +39,7 @@ final class TimezoneTest extends FireHubTestCase { * * @return void */ - #[DataProviderExternal(DateDataProvider::class, 'timezones')] + #[TestWith([Zone::ARCTIC_LONGYEARBYEN])] public function testSetAndGetDefaultTimezone (Zone $expected):void { self::assertTrue(Date\Timezone::setDefault($expected)); @@ -59,4 +58,4 @@ public function testAbbreviationList ():void { } -} \ No newline at end of file +}