PHP Class Bitpay\Util\Util

Afficher le fichier Open project: bitpay/php-client Class Usage Examples

Méthodes publiques

Méthode 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 méthode

Converts hex value into octet (byte) string
public static binConv ( $hex ) : string
Résultat string

checkRequirements() public static méthode

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

decToBin() public static méthode

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
Résultat string

decodeHex() public static méthode

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

doubleAndAdd() public static méthode

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

encodeHex() public static méthode

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

guid() public static méthode

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

nonce() public static méthode

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

pointAdd() public static méthode

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
Résultat Bitpay\PointInterface

pointDouble() public static méthode

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
Résultat Bitpay\PointInterface

ripe160() public static méthode

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

sha256() public static méthode

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
Résultat string

sha256ripe160() public static méthode

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

sha512() public static méthode

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
Résultat string

sha512hmac() public static méthode

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

twoSha256() public static méthode

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