承接 gabbro-php/crypt 相关项目开发

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

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

gabbro-php/crypt

最新稳定版本:1.006466

Composer 安装命令:

composer require gabbro-php/crypt

包简介

Encryption and Hash library

README 文档

README

This library provides a unified abstraction layer for message digests and symmetric ciphers, built around two core interfaces:

  • Digest — for hashing, HMACs, verification, and key derivation.
  • Cipher — for symmetric encryption and decryption.

It includes implementations backed by both PHP’s native extensions (hash, OpenSSL) and libsodium, so you can pick the provider that best fits your environment.

✨ Features

Digest

  • Unified interface for:
    • Hashing arbitrary data
    • Creating and verifying MACs
    • Deriving keys from global secrets + salt
  • Configurable “levels” for computational cost:
    • Fast (low iterations)
    • Moderate (default for most apps)
    • Sensitive (high security, slow, suitable for offline tasks)
  • Implementations:
    • HashDigest: Uses PHP’s hash_* and hash_pbkdf2
    • SodiumDigest: Uses libsodium’s crypto_pwhash, crypto_generichash, and crypto_auth

Cipher

  • Unified interface for symmetric encryption/decryption
  • Implementations:
    • SSLCipher: Wraps OpenSSL, supporting AES, Camellia, Aria, and many other algorithms/modes.
    • SodiumCipher: Wraps libsodium’s crypto_secretbox, providing authenticated encryption (confidentiality + integrity in one step).
  • Automatic key and IV/nonce management, with helpers for generation and normalization.

🔑 Security Model

  • OpenSSL ciphers: require explicit IVs and may require separate HMACs for authenticity (unless using AEAD modes like GCM).
  • Sodium ciphers: always use authenticated encryption (via XSalsa20 + Poly1305). Any tampering with ciphertext is detected during decryption.

This library ensures correct handling of secrets, salts, IVs, and nonces to reduce cryptographic misuse.

📦 Requirements

  • OpenSSL extension (for SSLCipher)
  • Libsodium extension (for SodiumCipher / SodiumDigest)

🔐 Philosophy

The main goal is to make crypto easy to use correctly:

  • Configure once (secret, salt, key size, cipher mode).
  • Use everywhere without boilerplate.
  • Provide safe defaults and abstract away low-level details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-27