Cache DoubleSha256Digest.hex (#1932)

* Cache DoubleSha256Digest.hex

* Cache little endian versino too
This commit is contained in:
Chris Stewart 2020-08-29 07:35:40 -05:00 committed by GitHub
parent c1d0d66398
commit 43ba2477b5

View File

@ -116,6 +116,8 @@ case class DoubleSha256Digest(bytes: ByteVector) extends HashDigest {
lazy val flip: DoubleSha256DigestBE = DoubleSha256DigestBE(bytes.reverse) lazy val flip: DoubleSha256DigestBE = DoubleSha256DigestBE(bytes.reverse)
override lazy val hex: String = bytes.toHex
override def toString = s"DoubleSha256Digest($hex)" override def toString = s"DoubleSha256Digest($hex)"
} }
@ -140,6 +142,8 @@ case class DoubleSha256DigestBE(bytes: ByteVector) extends HashDigest {
def flip: DoubleSha256Digest = def flip: DoubleSha256Digest =
DoubleSha256Digest.fromBytes(bytes.reverse) DoubleSha256Digest.fromBytes(bytes.reverse)
override lazy val hex: String = bytes.toHex
override def toString = s"DoubleSha256BDigestBE($hex)" override def toString = s"DoubleSha256BDigestBE($hex)"
} }