[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 /* 6 * The MIT License (MIT) 7 * 8 * Copyright (c) 2018-2020 Spomky-Labs 9 * 10 * This software may be modified and distributed under the terms 11 * of the MIT license. See the LICENSE file for details. 12 */ 13 14 namespace CBOR; 15 16 use Brick\Math\BigInteger; 17 18 /** 19 * @internal 20 */ 21 abstract class Utils 22 { 23 public static function binToInt(string $value): int 24 { 25 return self::binToBigInteger($value)->toInt(); 26 } 27 28 public static function binToBigInteger(string $value): BigInteger 29 { 30 return self::hexToBigInteger(bin2hex($value)); 31 } 32 33 public static function hexToInt(string $value): int 34 { 35 return self::hexToBigInteger($value)->toInt(); 36 } 37 38 public static function hexToBigInteger(string $value): BigInteger 39 { 40 return BigInteger::fromBase($value, 16); 41 } 42 43 public static function hexToString(string $value): string 44 { 45 return BigInteger::fromBase(bin2hex($value), 16)->toBase(10); 46 } 47 48 public static function intToHex(int $value): string 49 { 50 return BigInteger::of($value)->toBase(16); 51 } 52 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |