protected function isHash($length, $failMessage = null)
{
if (strlen($this->valueIsSet()->value) === $length) {
$this->matches('/^[a-fA-F0-9]+$/', $failMessage ?: $this->_('%s does not match given pattern', $this));
} else {
$this->fail($failMessage ?: $this->_('%s should be a string of %d characters', $this, $length));
}
return $this;
}