{"id":13828269,"url":"https://github.com/paragonie/constant_time_encoding","last_synced_at":"2025-04-14T20:43:21.563Z","repository":{"id":37773871,"uuid":"50963708","full_name":"paragonie/constant_time_encoding","owner":"paragonie","description":"Constant-Time Character Encoding in PHP Projects","archived":false,"fork":false,"pushed_at":"2024-06-25T13:10:05.000Z","size":184,"stargazers_count":847,"open_issues_count":3,"forks_count":34,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-11T13:55:49.867Z","etag":null,"topics":["base16","base32","base32hex","base64","base64-urlsafe","base64url","cache-timing-safe","character-encoding","constant-time","encoding","hexadecimal","php","rfc-4648","url-safe","urlsafe"],"latest_commit_sha":null,"homepage":"https://paragonie.com/blog/2016/06/constant-time-encoding-boring-cryptography-rfc-4648-and-you","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paragonie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-03T01:03:06.000Z","updated_at":"2025-04-09T18:21:27.000Z","dependencies_parsed_at":"2024-06-18T10:45:02.154Z","dependency_job_id":"367ea9bb-b5b8-4283-9146-0ec5f9544075","html_url":"https://github.com/paragonie/constant_time_encoding","commit_stats":{"total_commits":102,"total_committers":17,"mean_commits":6.0,"dds":0.4411764705882353,"last_synced_commit":"79daec8cf24be6d8d707e8a2cde460974b483d49"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fconstant_time_encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fconstant_time_encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fconstant_time_encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fconstant_time_encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paragonie","download_url":"https://codeload.github.com/paragonie/constant_time_encoding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714543,"owners_count":21149912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base16","base32","base32hex","base64","base64-urlsafe","base64url","cache-timing-safe","character-encoding","constant-time","encoding","hexadecimal","php","rfc-4648","url-safe","urlsafe"],"created_at":"2024-08-04T09:02:39.197Z","updated_at":"2025-04-14T20:43:21.542Z","avatar_url":"https://github.com/paragonie.png","language":"PHP","readme":"# Constant-Time Encoding\n\n[![Build Status](https://github.com/paragonie/constant_time_encoding/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/constant_time_encoding/actions)\n[![Static Analysis](https://github.com/paragonie/constant_time_encoding/actions/workflows/psalm.yml/badge.svg)](https://github.com/paragonie/constant_time_encoding/actions)\n[![Latest Stable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/stable)](https://packagist.org/packages/paragonie/constant_time_encoding)\n[![Latest Unstable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/unstable)](https://packagist.org/packages/paragonie/constant_time_encoding)\n[![License](https://poser.pugx.org/paragonie/constant_time_encoding/license)](https://packagist.org/packages/paragonie/constant_time_encoding)\n[![Downloads](https://img.shields.io/packagist/dt/paragonie/constant_time_encoding.svg)](https://packagist.org/packages/paragonie/constant_time_encoding)\n\nBased on the [constant-time base64 implementation made by Steve \"Sc00bz\" Thomas](https://github.com/Sc00bz/ConstTimeEncoding),\nthis library aims to offer character encoding functions that do not leak\ninformation about what you are encoding/decoding via processor cache \nmisses. Further reading on [cache-timing attacks](http://blog.ircmaxell.com/2014/11/its-all-about-time.html).\n\nOur fork offers the following enhancements:\n\n* `mbstring.func_overload` resistance\n* Unit tests\n* Composer- and Packagist-ready\n* Base16 encoding\n* Base32 encoding\n* Uses `pack()` and `unpack()` instead of `chr()` and `ord()`\n\n## PHP Version Requirements\n\nVersion 3 of this library should work on **PHP 8** or newer.\n\nVersion 2 of this library should work on **PHP 7** or newer. See [the v2.x branch](https://github.com/paragonie/constant_time_encoding/tree/v2.x).\n\nFor PHP 5 support, see [the v1.x branch](https://github.com/paragonie/constant_time_encoding/tree/v1.x).\n\nIf 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`.\n\n## How to Install\n\n```sh\ncomposer require paragonie/constant_time_encoding\n```\n\n## How to Use\n\n```php\nuse ParagonIE\\ConstantTime\\Encoding;\n\n// possibly (if applicable): \n// require 'vendor/autoload.php';\n\n$data = random_bytes(32);\necho Encoding::base64Encode($data), \"\\n\";\necho Encoding::base32EncodeUpper($data), \"\\n\";\necho Encoding::base32Encode($data), \"\\n\";\necho Encoding::hexEncode($data), \"\\n\";\necho Encoding::hexEncodeUpper($data), \"\\n\";\n```\n\nExample output:\n \n```\n1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE=\n2VMKKPSHSWVCVZJ6E7SONRY3ZXCNG3GE6ZZFU7TGJSX7KUKFNLAQ====\n2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq====\nd558a53e4795aa2ae53e27e4e6c71bcdc4d36cc4f6725a7e664caff551456ac1\nD558A53E4795AA2AE53E27E4E6C71BDCC4D36CC4F6725A7E664CAFF551456AC1\n```\n\nIf you only need a particular variant, you can just reference the \nrequired class like so:\n\n```php\nuse ParagonIE\\ConstantTime\\Base64;\nuse ParagonIE\\ConstantTime\\Base32;\n\n$data = random_bytes(32);\necho Base64::encode($data), \"\\n\";\necho Base32::encode($data), \"\\n\";\n```\n\nExample output:\n\n```\n1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE=\n2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq====\n```\n\n## Support Contracts\n\nIf your company uses this library in their products or services, you may be\ninterested in [purchasing a support contract from Paragon Initiative Enterprises](https://paragonie.com/enterprise).\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fconstant_time_encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparagonie%2Fconstant_time_encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fconstant_time_encoding/lists"}