承接 crowdstar/crypt 相关项目开发

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

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

crowdstar/crypt

最新稳定版本:2.0.1

Composer 安装命令:

composer require crowdstar/crypt

包简介

Handle data encryption/decryption.

README 文档

README

Library Status Latest Stable Version Latest Unstable Version License

Summary

The crypt package creates a simple interface for the phpseclib AES-128 library. Its interface allows encryption and decryption of strings with a layer of base64 encoding for easy transmission including the initialization vector.

Installation

composer require crowdstar/crypt:~2.0.0

Sample Usage

Before using the library, you need to choose a secret key, which should be of size 16, 24 or 32 only.

<?php
$secretKey = "1234567890123456";

1. Encrypt and Encode plain text data for storage or transmission

<?php
use CrowdStar\Crypt\Crypt;

$encodedEncryptedData = (new Crypt($secretKey))->encrypt("message");

2. Decoding and Decrypting stored or received data

<?php
use CrowdStar\Crypt\Crypt;

$encodedEncryptedData = (new Crypt($secretKey))->decrypt("encoded_encrypted_data");

3. Encrypting and Decrypting with an alternate length initialization vector

<?php
use CrowdStar\Crypt\Crypt;

$crypt = new Crypt($secretKey);

$alternateIVLength = 8;
$encodedEncryptedData = $crypt->encrypt("message", $alternateIVLength);
$plainText = $crypt->decrypt($encodedEncryptedData, $alternateIVLength);

When bad data is passed in, the return value of method call CrowdStar\Crypt\Crypt::decrypt() will be an empty string.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-10-09