@@ 31-34 (lines=4) @@ | ||
28 | { |
|
29 | $this->stream = $stream; |
|
30 | $options = [$algo]; |
|
31 | if ($key !== null && \strlen($key) > 0) { |
|
32 | $options[] = \HASH_HMAC; |
|
33 | $options[] = $key; |
|
34 | } |
|
35 | $context = \hash_init(...$options); |
|
36 | $this->stream->on('data', function ($data) use ($context): void { |
|
37 | \hash_update($context, $data); |
@@ 30-33 (lines=4) @@ | ||
27 | { |
|
28 | $this->stream = $stream; |
|
29 | $options = [$algo]; |
|
30 | if ($key !== null && \strlen($key) > 0) { |
|
31 | $options[] = \HASH_HMAC; |
|
32 | $options[] = $key; |
|
33 | } |
|
34 | $this->context = \hash_init(...$options); |
|
35 | $this->stream->once('close', function () use ($algo): void { |
|
36 | $hash = \hash_final($this->context, true); |