定制 ferdhika31/php-crispy 二次开发

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

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

ferdhika31/php-crispy

最新稳定版本:0.0.1

Composer 安装命令:

composer require ferdhika31/php-crispy

包简介

A custom Crypto utility PHP library that ports and wraps cryptography concepts from the go-crypsi module to make life easier when working with Digest, Cipher, HMAC, RSA, and RSA Digital Signatures natively in PHP.

README 文档

README

A custom Crypto utility PHP library that ports and wraps cryptography concepts from the go-crypsi module to make life easier when working with Digest, Cipher, HMAC, RSA, and RSA Digital Signatures natively in PHP.

Requirements

  • PHP 8.1 or higher
  • ext-openssl
  • ext-hash

Installation

You can install the package via composer:

composer require ferdhika31/php-crispy

(Note: During development, you can simply clone this repository and run composer install)

Features

The library is split into 4 core cryptography modules under the Ferdhika31\PhpCrispy namespace:

1. Aesx (Symmetric Encryption)

Provides AES encryption and decryption functions mapping to CBC, CFB, and GCM modes. It implicitly determines your AES key size (128, 192, or 256 bits).

use Ferdhika31\PhpCrispy\Aesx;

$key = "1234567890123456"; // 16 bytes = AES-128
$encrypted = Aesx::encryptCBC($key, "My Secret Data");
$decrypted = Aesx::decryptCBC($key, $encrypted);

2. Digestx (Hashing)

Provides easy-to-use variadic functions for standard checksums. Supports MD5, SHA1, SHA256, SHA384, and SHA512.

use Ferdhika31\PhpCrispy\Digestx;

$hex = Digestx::sha256Hex("hello", " ", "world"); 

3. Hmacx (Hash-based Message Authentication Code)

Provides HMAC signing capabilities guaranteeing data integrity, enforcing a minimum key length of 32 bytes for security.

use Ferdhika31\PhpCrispy\Hmacx;

$key = "super_secret_key_that_is_long_enough..";
$hmac = Hmacx::md5Hex($key, "My payload");

4. Rsax (Asymmetric Encryption & Signatures)

Provides RSA Key Generation, Public-Key Cryptography Standard (PKCS) Encryption via OAEP, and RSA Digital Signatures.

use Ferdhika31\PhpCrispy\Rsax;

// Generate pairs
$keys = Rsax::generateKeyPairs(2048);

// Sign Data
$signature = Rsax::signSha256($keys['private'], "Important Payload");

// Verify Data
$isValid = Rsax::verifySignSha256($keys['public'], "Important Payload", $signature);

Examples

To see full working examples for each algorithm, check the examples/ directory. Run them via terminal:

php examples/aes_sample.php
php examples/digest_sample.php
php examples/hmac_sample.php
php examples/rsa_sample.php

Testing

The library uses PHPUnit for robust testing. You can run the test suite by executing:

vendor/bin/phpunit tests

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固