for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Support.php
*
* PHP version 7
* @category Dcrypt
* @package Dcrypt
* @author Michael Meyer (mmeyer2k) <[email protected]>
* @license http://opensource.org/licenses/MIT The MIT License (MIT)
* @link https://github.com/mmeyer2k/dcrypt
*/
namespace Dcrypt;
* Provides numeric data conversion helper functions.
* @link https://apigen.ci/github/mmeyer2k/dcrypt/namespace-Dcrypt.html
class Support
{
* Turns an integer into a 4 byte binary representation
* @param int $dec Integer to convert to binary
* @return string
protected static function dec2bin(int $dec): string
return hex2bin(\str_pad(\dechex($dec), 8, '0', STR_PAD_LEFT));
}
* Reverses dec2bin
* @param string $bin Binary string to convert to decimal
protected static function bin2dec($bin)
return \hexdec(\bin2hex($bin));