承接 shiwildy/sencrypt 相关项目开发

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

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

shiwildy/sencrypt

最新稳定版本:1.0

Composer 安装命令:

composer require shiwildy/sencrypt

包简介

A secure and simple encryption library using SHA-512, AES-256-CBC, and BASE64.

README 文档

README

SEncrypt is a secure & simple encryption library using SHA-512, AES-256-CBC, and BASE64. It provides easy-to-use methods for encrypting and decrypting data securely.

Installation

composer require shiwildy/sencrypt

Example

<?php
    require 'vendor/autoload.php';
    use ShiWildy\SEncrypt;

    $plaintext = "Hello, just testing..";
    $password = "secret";

    try {
        $encrypted = SEncrypt::encrypt($plaintext, $password);
        echo "Encrypted: " . $encrypted . "\n\n";

        $decrypted = SEncrypt::decrypt($encrypted, $password);
        echo "Decrypted: " . $decrypted . "\n\n";

    } catch (Exception $e) {
        echo "An error occurred: " . $e->getMessage() . "\n";
    }
?>

How It Works ?

Encryption:

  • Salt Generation: A random salt generated to enhance security.
  • Key Derivation: Encryption key is derived from the provided password and generated salt using PBKDF2 Algoritm with SHA-512
  • IV Generation: A random initialization vector [IV] generated for use on AES-256-CBC
  • Combining Data: Salt, IV, and encrypted data are concatenated and then encoded using base64 to create final encrypted output.

Decryption:

  • Base64 Decode: Encrypted data is first decoded from Base64.
  • Data Extraction: salt, IV, and encrypted text are extracted from decoded data.
  • Key Derivation: Decryption key is derived using same method in encryption.
  • Decryption: Encrypted data is decrypted using derived key and IV.
  • Output: Decrypted text returned.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

License

This project licensed under The MIT License

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-02