承接 carry0987/hash 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

carry0987/hash

最新稳定版本:1.1.0

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.

统计信息

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

GitHub 信息

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

其他信息

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