Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Keccak Laravel Package

kornrunner/keccak

Pure PHP Keccak (SHA-3) implementation with easy static API. Compute Keccak hashes (224/256/384/512) and SHAKE outputs (XOF) without extensions. Includes test suite and coverage, suitable for Ethereum and other crypto use cases.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enhanced Cryptographic Security for Laravel Applications: Enable SHA-3/Keccak-based hashing for sensitive operations where standard PHP hashing (e.g., hash() or OpenSSL) is insufficient or unavailable. Use cases include:

    • Password Hashing Alternatives: Combine with Argon2 for memory-hard hashing while using Keccak for deterministic salt derivation.
    • Blockchain Integration: Generate Ethereum-compatible hashes (e.g., Keccak-256 for wallet addresses, smart contract inputs) without relying on external APIs like Infura or Web3.js.
    • Data Integrity: Validate API payloads, database records, or user-generated content with NIST-approved hashing (SHA-3 is a FIPS 202 standard).
  • Compliance and Future-Proofing:

    • Regulatory Requirements: Meet standards like NIST SP 800-185 (SHA-3) for government or healthcare applications.
    • Post-Quantum Readiness: SHA-3 (Keccak) is a candidate for post-quantum cryptography; adopting it now future-proofs against quantum threats.
    • Auditability: Provide cryptographic proofs for data integrity in decentralized systems (e.g., Merkle trees, audit logs).
  • Build vs. Buy Decision:

    • Buy This Package When:
      • Your stack is PHP-only (no OpenSSL or hash() support for SHA-3).
      • You need portability (e.g., serverless environments like AWS Lambda where extensions are restricted).
      • MIT license aligns with your open-source policy, and you can tolerate the maintenance risk.
    • Build When:
      • You require hardware acceleration (e.g., Intel SHA extensions) for performance-critical paths.
      • You need custom Keccak variants beyond SHA-3 (e.g., SHAKE for extendable-output functions).
      • Active maintenance is a hard requirement (consider forking or using a more actively maintained alternative like paragonie/sodium_compat).
  • Roadmap Prioritization:

    • Short-Term (MVP):
      • Integrate into authentication flows (e.g., Keccak for salt hashing alongside Argon2).
      • Use for blockchain-related features (e.g., Ethereum address generation in a crypto wallet app).
    • Mid-Term (Scaling):
      • Implement Merkle trees for decentralized applications (DApps) or immutable audit logs.
      • Add custom hash drivers in Laravel to unify Keccak with existing Hash facade.
    • Long-Term (Innovation):
      • Explore post-quantum cryptography by extending Keccak for experimental algorithms.
      • Benchmark and optimize for high-throughput systems (e.g., bulk hashing with parallel processing).

When to Consider This Package

  • Adopt When:

    • Your application requires SHA-3/Keccak hashing (224–512 bits or SHAKE) but lacks OpenSSL or native PHP support.
    • You’re building a PHP-first system (e.g., Laravel, Symfony) where extension dependencies are undesirable or restricted.
    • Deterministic hashing is critical for:
      • Blockchain interoperability (e.g., Ethereum address generation).
      • Content addressing (e.g., IPFS-like systems).
      • Compliance with NIST/FIPS standards.
    • You need SHAKE for custom-length cryptographic outputs (e.g., signatures, key derivation).
    • Performance trade-offs are acceptable for your use case (e.g., low-volume operations like auth salts).
  • Look Elsewhere If:

    • Performance is critical: Pure PHP Keccak is ~10–100x slower than OpenSSL. Use native libraries for bulk hashing or high-throughput systems.
    • FIPS 140-3 certification is required: This package is not certified; use system libraries (e.g., OpenSSL) instead.
    • Active maintenance is a priority: Last release was 2020; fork or patch if critical bugs arise.
    • Alternatives suffice:
      • PHP 8.1+ includes SHA-3 in hash_algos(), but may not support all Keccak variants.
      • For blockchain, prefer web3.php or ethereumjs-util for higher-level abstractions.
    • You need hardware acceleration: Use system libraries (e.g., OpenSSL with Intel SHA extensions).

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us use SHA-3/Keccak hashing—the industry-standard for cryptographic integrity—without adding system dependencies. Here’s why it matters:

  • Security: Future-proofs our auth systems with NIST-approved hashing, reducing risk of algorithm deprecation.
  • Blockchain: Enables Ethereum-compatible features (e.g., wallet addresses) in-house, cutting costs and latency from third-party APIs.
  • Compliance: Meets strict data integrity requirements for healthcare, finance, or government projects.
  • Flexibility: Works in any PHP environment, including serverless or shared hosting where extensions are disabled.

Trade-off: A minor performance hit vs. native libraries, but we gain portability and control over our crypto stack. The MIT license means no licensing costs, and the package is lightweight to integrate.

Recommendation: Pilot this for non-critical hashing (e.g., auth salts, blockchain addresses) and benchmark before scaling."*


For Engineering:

*"Why Use This Package?

  • Pure PHP: No extensions needed; works in Laravel/Symfony/serverless.
  • SHA-3/SHAKE: Supports all Keccak variants (224–512 bits + extendable output).
  • Battle-tested: 125 stars, CI/CD, and coverage reports.

Key Risks:

  • Slower than OpenSSL: Benchmark before production use (e.g., avoid for bulk hashing).
  • Stale maintenance: Last release in 2020; monitor for forks or updates.

Proposed Integration:

  1. Direct Usage: Replace hardcoded hashes with Keccak::hash($data, 256).
  2. Facade Wrapper (Recommended for Laravel):
    // app/Providers/AppServiceProvider.php
    Hash::extend('keccak', function() {
        return function($value, array $options = []) {
            return Keccak::hash($value, $options['rounds'] ?? 256);
        };
    });
    
    Then use: Hash::driver('keccak')->make($value).

Example Use Case:

// Generate Ethereum address hash (Keccak-256)
$addressHash = Keccak::hash($walletData, 256);

Next Steps:

  • Benchmark against OpenSSL for critical paths.
  • Add Laravel-specific tests (e.g., integration with Hash facade).
  • Plan for a fallback to OpenSSL if available."*

For Security/Compliance Teams:

*"Why SHA-3/Keccak?

  • NIST/FIPS Compliant: SHA-3 (Keccak) is a FIPS 202 standard, meeting regulatory requirements for cryptographic hashing.
  • Post-Quantum Ready: Keccak is a SHA-3 finalist and candidate for quantum-resistant algorithms.
  • Deterministic: Ideal for blockchain, audit logs, and data integrity where reproducibility is critical.

Risks Mitigated:

  • No OpenSSL Dependency: Avoids potential vulnerabilities in system libraries.
  • Pure PHP: Reduces attack surface by eliminating extension-based risks.

Recommendation:

  • Use for high-assurance hashing (e.g., passwords, contracts, blockchain data).
  • Pair with Argon2 for memory-hard key derivation.
  • Audit the package’s implementation against NIST test vectors to ensure correctness."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky