定制 trihydera/hashutils 二次开发

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

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

trihydera/hashutils

最新稳定版本:v1.0.1

Composer 安装命令:

composer require trihydera/hashutils

包简介

README 文档

README

A simple PHP library for hashing text, getting and verifying an user hash

Getting started

Require this package, with Composer, in the root directory of your project.

composer require trihydera/hashutils

HashID Class

Overview

The HashID class is designed to handle generating and verifying hashed user IDs based on the user's IP address.

Usage

  1. Instantiate the HashID class by providing an optional salt value.
  2. Use the gen() method to generate a hashed ID based on the user's IP address.
  3. Use the verify($hash) method to verify if a given hash matches the generated hash.

Example

<?php
use Trihydera\Hashutils\HashID;

// Instantiate HashID class
$hashId = new HashID('mysalt');

// Generate a hashed ID
$generatedHash = $hashId->gen();

// Verify a hash
$isValid = $hashId->verify($generatedHash);
?>

HashText Class

Overview

The HashText class is a PHP utility class that provides functionality to hash text content using different algorithms. It allows you to generate hashed strings for text content with added security through salting.

Installation

You can include the HashText class in your project by requiring the relevant PHP file or using an autoloader.

Usage

  1. Instantiate the HashText class by providing an optional salt value.
  2. Call the gen($content) method with the text content you want to hash.
  3. The method will return a concatenated hash string generated using the specified algorithms.

Example

<?php
use Trihydera\Hashutils\HashText;

// Instantiate HashText class with a custom salt
$hashText = new HashText('mysalt');

// Generate a hashed string for the text "Hello, World!"
$hashedContent = $hashText->gen('Hello, World!');

echo $hashedContent;
?>

Features

  • Supports hashing text content using the md5 and sha256 algorithms.
  • Allows customization of the salt value for added security.
  • Returns a concatenated hash string derived from multiple hashing algorithms.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2024-06-16