com.wavesplatform.crypto.Sha256.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lang Show documentation
Show all versions of lang Show documentation
The RIDE smart contract language compiler
The newest version!
package com.wavesplatform.crypto
import java.security.MessageDigest
object Sha256 {
private[this] val digest = new ThreadLocal[MessageDigest]() {
override def initialValue(): MessageDigest = MessageDigest.getInstance("SHA-256")
}
def hash(message: Array[Byte]): Array[Byte] = {
val result = digest.get().digest(message)
digest.get().reset()
result
}
}