Bitcoin::Crypto::Util - Basic utilities for working with bitcoin
use Bitcoin::Crypto::Util qw( validate_wif get_key_type get_path_info );
These are basic utilities for working with bitcoin, used by other packages.
my $bool = validate_wif($str);
Ensures Base58 encoded string looks like encoded private key in WIF format. Throws an exception if $str is not valid base58.
my $is_private = get_key_type($bytestr);
Checks if the $bytestr looks like a valid ASN X9.62 format (compressed / uncompressed / hybrid public key or private key entropy up to curve size bits). Returns boolean which can be used to determine if the key is private. Returns undef if $bytestr does not look like a valid key entropy.
my $path = "m/1/3'"; my $path_data = get_path_info($path);
Tries to get derivation path data from $path. Returns undef if $path is not a valid path. Otherwise returns the structure:
{ private => bool, # is path derivation private (lowercase m) path => [ # derivation path with 2^31 added to every hardened child number int, int, .. ], }
To install Bitcoin::Crypto, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bitcoin::Crypto
CPAN shell
perl -MCPAN -e shell install Bitcoin::Crypto
For more information on module installation, please visit the detailed CPAN module installation guide.