syrian-lucianos/base16-php 问题修复 & 功能扩展

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

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

syrian-lucianos/base16-php

Composer 安装命令:

composer require syrian-lucianos/base16-php

包简介

Encoding And Decoding Text Using Only 16 Characters

README 文档

README

Encoding And Decoding Text Using Only 16 Characters

Installation

First make sure you have composer installed on your device.

From your terminal, navigate to your project folder and run this command:

composer require syrian-lucianos/base16-php

And that's all!

Usage

The library supports two flavors of programming paradigms:

  • Procedural Programming
  • Object Oriented Programming

Procedural Programming

Use the base16_encode() and base16_decode() functions to respectively encode and decode your text content.

For example:

$text = "Hello World!, This is a test.";
$encoded = base16_encode($text); 
echo $encoded . PHP_EOL;  // Output "48656c6c6f20576f726c64212c2054686973206973206120746573742e"
$decoded = base16_decode($encoded); 
echo $decoded . PHP_EOL;  // Output "Hello World!, This is a test."

Object Oriented Programming

The object oriented version of the library provides Base16 class alongside its static Encode() and Decode() methods to respectively encode and decode your text content as follows:

$text = "Hello World!, This is a test.";
$encoded = Base16::Encode($text); 
echo $encoded . PHP_EOL;  // Output "48656c6c6f20576f726c64212c2054686973206973206120746573742e"
$decoded = Base16::Decode($encoded); 
echo $decoded . PHP_EOL;  // Output "Hello World!, This is a test."

More info

This algorithm replace each ASCII character with two ASCII characters, therefore there's a double overhead.

In a mathematical language, if the text is n bytes in size (or length, doesn't matter because we're using ASCII), then the resultant text will be 2*n bytes in size, this implies a 100% increment in size (overhead), unlike Base64 which has approximately 33.333333% overhead.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-08-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固