1 | <?php |
||
19 | class Hashlock |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private static $sizeMap = [ |
||
25 | Opcodes::OP_RIPEMD160 => 20, |
||
26 | Opcodes::OP_SHA1 => 20, |
||
27 | Opcodes::OP_SHA256 => 32, |
||
28 | Opcodes::OP_HASH256 => 32, |
||
29 | Opcodes::OP_HASH160 => 20, |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * @var BufferInterface |
||
34 | */ |
||
35 | private $hash; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $opcode; |
||
41 | |||
42 | /** |
||
43 | * Hashlock constructor. |
||
44 | * @param BufferInterface $hash |
||
45 | * @param $opcode |
||
46 | */ |
||
47 | public function __construct(BufferInterface $hash, $opcode) |
||
61 | |||
62 | /** |
||
63 | * @return BufferInterface |
||
64 | */ |
||
65 | public function getHash() |
||
69 | |||
70 | /** |
||
71 | * @return int |
||
72 | */ |
||
73 | public function getOpcode() |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @param BufferInterface $preimage |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function checkPreimage(BufferInterface $preimage) |
||
107 | } |
||
108 |