diff options
-rw-r--r-- | libraries/eval/Eval.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libraries/eval/Eval.scala b/libraries/eval/Eval.scala index 6d1bd6e..8d38caa 100644 --- a/libraries/eval/Eval.scala +++ b/libraries/eval/Eval.scala @@ -69,12 +69,13 @@ object Eval { private val compilerPath = jarPathOfClass("scala.tools.nsc.Interpreter") private val libPath = jarPathOfClass("scala.ScalaObject") private val jvmId = java.lang.Math.abs(new Random().nextInt()) + private val md = MessageDigest.getInstance("SHA") /** * Eval[Int]("1 + 1") // => 2 */ - def apply[T](stringToEval: String): T = { - val md = MessageDigest.getInstance("SHA") + def apply[T](stringToEval: String): T = synchronized { + md.reset() val digest = md.digest(stringToEval.getBytes()) val sha = new BigInteger(1, digest).toString(16) |