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
- Instantiate the
HashIDclass by providing an optional salt value. - Use the
gen()method to generate a hashed ID based on the user's IP address. - 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
- Instantiate the
HashTextclass by providing an optional salt value. - Call the
gen($content)method with the text content you want to hash. - 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
md5andsha256algorithms. - 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
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2024-06-16