File Coverage

blib/lib/Bitcoin/Crypto/Constants.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Bitcoin::Crypto::Constants;
2             $Bitcoin::Crypto::Constants::VERSION = '2.000_01'; # TRIAL
3             $Bitcoin::Crypto::Constants::VERSION = '2.00001';
4 37     37   70236 use v5.10;
  37         166  
5 37     37   223 use strict;
  37         95  
  37         1106  
6 37     37   213 use warnings;
  37         113  
  37         1090  
7              
8 37     37   243 use Config;
  37         73  
  37         3963  
9              
10             # These constants generally safe to use outside Bitcoin::Crypto code if you
11             # need them
12             use constant {
13 37         10325 curve_name => 'secp256k1',
14             max_child_keys => (2 << 30),
15             key_max_length => 32,
16             wif_compressed_byte => "\x01",
17             segwit_witness_version => 0,
18             taproot_witness_version => 1,
19             max_witness_version => 16,
20              
21             bip44_purpose => 44,
22             bip44_compat_purpose => 49,
23             bip44_segwit_purpose => 84,
24              
25             units_per_coin => 100_000_000,
26              
27             locktime_height_threshold => 500_000_000,
28             max_sequence_no => 0xffffffff,
29              
30             sighash_all => 0x01,
31             sighash_none => 0x02,
32             sighash_single => 0x03,
33             sighash_anyonecanpay => 0x80,
34              
35             p2sh_timestamp_threshold => 1333238400,
36             rbf_sequence_no_threshold => 0xffffffff - 2,
37 37     37   545 };
  37         94  
38              
39             # These constants are environment-specific and internal only
40             use constant {
41             ivsize => $Config{ivsize},
42             is_32bit => $Config{ivsize} == 4,
43 37         6510 is_64bit => $Config{ivsize} >= 8,
44 37     37   277 };
  37         122  
45              
46             1;
47