public function hash(string $directive = 'script-src', string $script = '', string $algorithm = 'sha384') : self
{
$ruleKeys = \array_keys($this->policies);
if (\in_array($directive, $ruleKeys)) {
$this->policies[$directive]['hashes'][] = [$algorithm => Base64::encode(\hash($algorithm, $script, true))];
}
return $this;
}