PHP Class Bitpay\Util\Util

Exibir arquivo Open project: bitpay/php-client Class Usage Examples

Public Methods

Method Description
binConv ( $hex ) : string Converts hex value into octet (byte) string
checkRequirements ( ) : array Checks dependencies for the library
decToBin ( $dec ) : string This method returns a binary string representation of the decimal number. Used for the doubleAndAdd() method.
decodeHex ( string $hex ) : string Decodes a hexadecimal value into decimal.
doubleAndAdd ( $hex, Bitpay\PointInterface $point, Bitpay\Util\CurveParameterInterface $parameters = null )
encodeHex ( string $dec ) : string Encodes a decimal value into hexadecimal.
guid ( ) : string Returns a GUID for use in REST calls.
nonce ( ) : string Returns a nonce for use in REST calls.
pointAdd ( Bitpay\PointInterface $P, Bitpay\PointInterface $Q ) : Bitpay\PointInterface Point addition method P + Q = R where: s = (yP - yQ)/(xP - xQ) mod p xR = s2 - xP - xQ mod p yR = -yP + s(xP - xR) mod p
pointDouble ( Bitpay\PointInterface $point, Bitpay\Util\CurveParameterInterface $parameters = null ) : Bitpay\PointInterface Point multiplication method 2P = R where s = (3xP2 + a)/(2yP) mod p xR = s2 - 2xP mod p yR = -yP + s(xP - xR) mod p
ripe160 ( string $data, $binary = false ) : string Returns a RIPDEMD160 hash of a value.
sha256 ( string $data, $binary = false ) : string Computes a digest hash value for the given data using the given method, and returns a raw or binhex encoded string, see: http://us1.php.net/manual/en/function.openssl-digest.php
sha256ripe160 ( string $data ) : string Returns a SHA256 hash of a RIPEMD160 hash of a value.
sha512 ( string $data ) : string Computes a digest hash value for the given data using the given method, and returns a raw or binhex encoded string, see: http://us1.php.net/manual/en/function.openssl-digest.php
sha512hmac ( string $data, string $key ) : string Generate a keyed hash value using the HMAC method.
twoSha256 ( string $data, $binary = false ) : string Returns a double SHA256 hash of a value.

Method Details

binConv() public static method

Converts hex value into octet (byte) string
public static binConv ( $hex ) : string
return string

checkRequirements() public static method

Checks dependencies for the library
public static checkRequirements ( ) : array
return array list of each requirement, boolean true if met, string error message if not as value

decToBin() public static method

This method returns a binary string representation of the decimal number. Used for the doubleAndAdd() method.
See also: http://php.net/manual/en/function.decbin.php but for large numbers
public static decToBin ( $dec ) : string
return string

decodeHex() public static method

Decodes a hexadecimal value into decimal.
public static decodeHex ( string $hex ) : string
$hex string
return string

doubleAndAdd() public static method

public static doubleAndAdd ( $hex, Bitpay\PointInterface $point, Bitpay\Util\CurveParameterInterface $parameters = null )
$point Bitpay\PointInterface
$parameters Bitpay\Util\CurveParameterInterface

encodeHex() public static method

Encodes a decimal value into hexadecimal.
public static encodeHex ( string $dec ) : string
$dec string
return string

guid() public static method

Returns a GUID for use in REST calls.
See also: http://en.wikipedia.org/wiki/Globally_unique_identifier
public static guid ( ) : string
return string

nonce() public static method

Returns a nonce for use in REST calls.
See also: http://en.wikipedia.org/wiki/Cryptographic_nonce
public static nonce ( ) : string
return string

pointAdd() public static method

Point addition method P + Q = R where: s = (yP - yQ)/(xP - xQ) mod p xR = s2 - xP - xQ mod p yR = -yP + s(xP - xR) mod p
public static pointAdd ( Bitpay\PointInterface $P, Bitpay\PointInterface $Q ) : Bitpay\PointInterface
$P Bitpay\PointInterface
$Q Bitpay\PointInterface
return Bitpay\PointInterface

pointDouble() public static method

Point multiplication method 2P = R where s = (3xP2 + a)/(2yP) mod p xR = s2 - 2xP mod p yR = -yP + s(xP - xR) mod p
public static pointDouble ( Bitpay\PointInterface $point, Bitpay\Util\CurveParameterInterface $parameters = null ) : Bitpay\PointInterface
$point Bitpay\PointInterface
$parameters Bitpay\Util\CurveParameterInterface
return Bitpay\PointInterface

ripe160() public static method

Returns a RIPDEMD160 hash of a value.
public static ripe160 ( string $data, $binary = false ) : string
$data string
return string

sha256() public static method

Computes a digest hash value for the given data using the given method, and returns a raw or binhex encoded string, see: http://us1.php.net/manual/en/function.openssl-digest.php
public static sha256 ( string $data, $binary = false ) : string
$data string
return string

sha256ripe160() public static method

Returns a SHA256 hash of a RIPEMD160 hash of a value.
public static sha256ripe160 ( string $data ) : string
$data string
return string

sha512() public static method

Computes a digest hash value for the given data using the given method, and returns a raw or binhex encoded string, see: http://us1.php.net/manual/en/function.openssl-digest.php
public static sha512 ( string $data ) : string
$data string
return string

sha512hmac() public static method

http://us1.php.net/manual/en/function.hash-hmac.php
public static sha512hmac ( string $data, string $key ) : string
$data string
$key string
return string

twoSha256() public static method

Returns a double SHA256 hash of a value.
public static twoSha256 ( string $data, $binary = false ) : string
$data string
return string