2017 © Pedro Peláez
 

library constant_time_encoding

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

image

paragonie/constant_time_encoding

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  • Monday, June 4, 2018
  • by paragonie-scott
  • Repository
  • 16 Watchers
  • 130 Stars
  • 1,290,598 Installations
  • PHP
  • 62 Dependents
  • 1 Suggesters
  • 12 Forks
  • 1 Open issues
  • 23 Versions
  • 17 % Grown

The README.md

Constant-Time Encoding

Build Status Static Analysis Latest Stable Version Latest Unstable Version License Downloads, (*1)

Based on the constant-time base64 implementation made by Steve "Sc00bz" Thomas, this library aims to offer character encoding functions that do not leak information about what you are encoding/decoding via processor cache misses. Further reading on cache-timing attacks., (*2)

Our fork offers the following enhancements:, (*3)

  • mbstring.func_overload resistance
  • Unit tests
  • Composer- and Packagist-ready
  • Base16 encoding
  • Base32 encoding
  • Uses pack() and unpack() instead of chr() and ord()

PHP Version Requirements

Version 3 of this library should work on PHP 8 or newer., (*4)

Version 2 of this library should work on PHP 7 or newer. See the v2.x branch., (*5)

For PHP 5 support, see the v1.x branch., (*6)

If you are adding this as a dependency to a project intended to work on PHP 5 through 8.4, please set the required version to ^1|^2|^3., (*7)

How to Install

composer require paragonie/constant_time_encoding

How to Use

use ParagonIE\ConstantTime\Encoding;

// possibly (if applicable): 
// require 'vendor/autoload.php';

$data = random_bytes(32);
echo Encoding::base64Encode($data), "\n";
echo Encoding::base32EncodeUpper($data), "\n";
echo Encoding::base32Encode($data), "\n";
echo Encoding::hexEncode($data), "\n";
echo Encoding::hexEncodeUpper($data), "\n";

Example output:, (*8)

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

If you only need a particular variant, you can just reference the required class like so:, (*9)

use ParagonIE\ConstantTime\Base64;
use ParagonIE\ConstantTime\Base32;

$data = random_bytes(32);
echo Base64::encode($data), "\n";
echo Base32::encode($data), "\n";

Example output:, (*10)

1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE=
2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq====

Support Contracts

If your company uses this library in their products or services, you may be interested in purchasing a support contract from Paragon Initiative Enterprises., (*11)

The Versions

04/06 2018

dev-master

9999999-dev

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

30/04 2018

v1.x-dev

1.9999999.9999999.9999999-dev

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

30/04 2018

v1.0.4

1.0.4.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

29/04 2018

v1.0.3

1.0.3.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

10/03 2018

v2.2.2

2.2.2.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

10/03 2018

v1.0.2

1.0.2.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

23/01 2018

v2.2.1

2.2.1.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

22/09 2017

v2.2.0

2.2.0.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

16/09 2017

v2.1.1

2.1.1.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

11/07 2016

v2.0.3

2.0.3.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

13/06 2016

v2.0.2

2.0.2.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

13/06 2016

v1.0.1

1.0.1.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

10/05 2016

v2.0.1

2.0.1.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

08/04 2016

v2.0.0

2.0.0.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

08/04 2016

v1.0.0

1.0.0.0

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

base32 rfc4648 encoding hex base64 base16 bin2hex hex2bin base64_encode base64_decode base32_encode base32_decode

08/04 2016

v0.6.0

0.6.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

rfc4648 encoding base64

24/03 2016

v0.5.1

0.5.1.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

rfc4648 encoding base64

14/03 2016

v0.5.0

0.5.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

rfc4648 encoding base64

14/03 2016

v0.4.0

0.4.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.3|^7

 

The Development Requires

rfc4648 encoding base64

12/03 2016

v0.3.0

0.3.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.5|^7

 

The Development Requires

rfc4648 encoding base64

12/03 2016

v0.2.1

0.2.1.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.5|^7

 

The Development Requires

rfc4648 encoding base64

12/03 2016

v0.2.0

0.2.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.5|^7

 

The Development Requires

rfc4648 encoding base64

03/02 2016

0.1.0

0.1.0.0

Constant-time Implementations of RFC 4648 Base-64 Encoding (original by Steve 'Sc00bz' Thomas)

  Sources   Download

MIT

The Requires

  • php ^5.5|^7

 

The Development Requires

rfc4648 encoding base64