hylianshield/base32-crockford 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

hylianshield/base32-crockford

最新稳定版本:1.0.1

Composer 安装命令:

composer require hylianshield/base32-crockford

包简介

Implementation of Crockford's Base 32 encoder and decoder

README 文档

README

This package holds an encoder / decoder that implements Crockford's Base 32 implementation.

Installation

composer require hylianshield/base32-crockford:^1.0

Specification

Attribute Value
Padding 0 (required)
Partitioning - (optional)

Usage

<?php
use HylianShield\Encoding\Base32CrockfordEncoder;

$encoder = new Base32CrockfordEncoder();

$encoded = $encoder->encode(1337);        // 0000019S5
$decoded = $encoder->decode('0000019S5'); // 1337

Limitations

While big numbers can be properly encoded, the built-in multiply operation for PHP fails to return the correct response if a number gets too high.

This can be solved by using BC Math, however, since that is not installed by default, this implementation has an upper-limit.

On the tested system, the upper limit lies between 18.014.398.509.481.982 and 36.028.797.018.963.966. Read: 18 quadrillion and 36 quadrillion respectively. This may differ when using a different CPU architecture.

See the example script to reproduce these findings. Or simply run:

composer example

Which outputs:

... previous rows ...
#2251799813685246 => 000001ZZ-ZZZZZZZYN => 2251799813685246
#4503599627370494 => 000003ZZ-ZZZZZZZY7 => 4503599627370494
#9007199254740990 => 000007ZZ-ZZZZZZZYG => 9007199254740990
#18014398509481982 => 00000FZZ-ZZZZZZZY$ => 18014398509481982
#36028797018963966 => 00001000-0000000Y~ => 
	Check symbol "~" (33) mismatches "10000000000Y" (36028797018963998).

One can see that the number on the left no longer matches the number on the right.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-01-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固