carry0987/hash 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

carry0987/hash

Composer 安装命令:

composer require carry0987/hash

包简介

PHP-Hash is a comprehensive library designed to facilitate the generation of securely encrypted URLs.

README 文档

README

Packgist
PHP-Hash is a comprehensive library designed to facilitate the generation of securely encrypted URLs. With support for customizable encryption algorithms and AEAD (Authenticated Encryption with Additional Data) cipher modes, it offers flexibility while ensuring the integrity and authenticity of the data.

Features

  • Easy generation of encrypted URLs.
  • Support for a variety of encryption algorithms and AEAD cipher modes.
  • Customizable prefixes, suffixes, and path formatting for encrypted URLs.
  • Integration with the Composer package manager for straightforward installation.

Installation

Use Composer to install PHP-Hash in your project:

composer require carry0987/hash

Usage

To use PHP-Hash to generate encrypted URLs, follow these steps:

  1. Initialization:
use carry0987\Hash\Hash;

// Initialize with your signature key and signature salt
$hash = new Hash('your_hex_signature_key', 'your_hex_signature_salt');
  1. Configuration (Optional): Customize encryption settings as needed.
// Set a custom encryption cipher
$hash->setCipher('aes-256-gcm');

// Set a custom encryption algorithm for generating binary signatures
$hash->setEncryptAlgorithm('sha256');

// Optionally, set a custom Additional Authenticated Data (AAD) for AEAD ciphers
$hash->setAAD('your_custom_aad');

// Customize the encrypted path's prefix and suffix
$hash->setPrefix('/custom-prefix');
$hash->setSuffix('/custom-suffix');
  1. Generate Encrypted URL:
$originalUrl = 'https://yourdomain.com/original/path';
$encryptedUrl = $hash->generateEncryptedUrl($originalUrl);
echo $encryptedUrl;

Custom Path Formatting

PHP-Hash allows for custom formatting of the encrypted path through a user-defined callback function:

$hash->setPathFormatter(function ($encryptedUrl, $options) {
    // Your custom logic here
    return "/custom/format/$encryptedUrl";
});

License

This project is licensed under the MIT License. See the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固