承接 skywalker-labs/constant-time-encoding 相关项目开发

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

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

skywalker-labs/constant-time-encoding

最新稳定版本:v1.0.0

Composer 安装命令:

composer require skywalker-labs/constant-time-encoding

包简介

Constant-time implementations of RFC 4648 encoding (Base64, Base32, Hex) and other variants (Base64UrlSafe, Base64DotSlash, Base32Hex)

README 文档

README

Build Status Static Analysis Latest Stable Version Latest Unstable Version License Downloads

Constant-time implementations of RFC 4648 encoding (Base64, Base32, Hex) and other variants.

This library aims to offer character encoding functions that do not leak information about what you are encoding/decoding via processor cache misses.

Features

  • Constant-Time Encoding/Decoding: Prevents cache-timing attacks.
  • Multiple Encodings:
    • Base64 (RFC 4648)
    • Base64UrlSafe (URL-safe variant)
    • Base64DotSlash (Crypt version, ./[A-Z][a-z][0-9])
    • Base64DotSlashOrdered (Ordered variant, [.-9][A-Z][a-z])
    • Base32 (RFC 4648)
    • Base32Hex (RFC 4648 base32hex)
    • Hex (Base16)
  • Security: Uses pack() and unpack() instead of chr() and ord() for safer bit manipulation.
  • Robust: Strict padding validation (optional).

Requirements

  • PHP 7.4 or newer (including PHP 8.x).

Installation

composer require skywalker-labs/constant-time-encoding

Usage

You can use the Skywalker\ConstantTime\Encoding class as a facade for all encoding methods, or use specific classes directly.

Using the Encoding Facade

use Skywalker\ConstantTime\Encoding;

// Sample data
$data = random_bytes(32);

// Base64
echo Encoding::base64Encode($data), "\n";

// Base32 (Uppercase)
echo Encoding::base32EncodeUpper($data), "\n";

// Base32 (Standard)
echo Encoding::base32Encode($data), "\n";

// Hex (Base16)
echo Encoding::hexEncode($data), "\n";
echo Encoding::hexEncodeUpper($data), "\n";

Using Specific Classes

If you only need a specific encoding, you can import the relevant class directly:

use Skywalker\ConstantTime\Base64;
use Skywalker\ConstantTime\Base32;
use Skywalker\ConstantTime\Hex;

$data = random_bytes(32);

// Encode
$b64 = Base64::encode($data);
$b32 = Base32::encode($data);
$hex = Hex::encode($data);

// Decode
$raw = Base64::decode($b64);

Output Example

1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE=
2VMKKPSHSWVCVZJ6E7SONRY3ZXCNG3GE6ZZFU7TGJSX7KUKFNLAQ====
2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq====
d558a53e4795aa2ae53e27e4e6c71bcdc4d36cc4f6725a7e664caff551456ac1
D558A53E4795AA2AE53E27E4E6C71BDCC4D36CC4F6725A7E664CAFF551456AC1

Security

This library was designed to eliminate cache-timing side-channels from encoding operations. It is intended for use in cryptographic contexts where timing leaks could expose sensitive data.

Support

If your company uses this library in their products or services, you may be interested in purchasing a support contract from Skywalker Labs.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固