定制 componenta/hasher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componenta/hasher

Composer 安装命令:

composer require componenta/hasher

包简介

Stream-aware content hashing contract and default implementation

README 文档

README

Stream-aware content hashing contract and default implementation.

Use this package when services need to hash either an in-memory string or a PSR-7 stream through one small abstraction.

Installation

composer require componenta/hasher

Usage

use Componenta\Stdlib\Hasher;

$hasher = new Hasher('sha256');

$hash = $hasher->hash('content');
$sha1 = $hasher->withAlgorithm('sha1');

Hasher exposes the selected algorithm as read-only public state:

$hasher->algorithm; // sha256

withAlgorithm() returns a new immutable instance.

Contract

use Psr\Http\Message\StreamInterface;

interface HasherInterface
{
    public function hash(string|StreamInterface $input): string;
}

When a stream is passed, the default implementation rewinds the stream before hashing and rewinds it again after hashing. This lets callers pass the same stream to storage after computing its digest.

Related Packages

Package Why it matters here
componenta/file-hasher Hashes files by filename.
componenta/password Hashes passwords with PHP's dedicated password API.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固