Skip to content
Permalink
Browse files

Upgrade SparkMD5 for checksum generation in JS

  • Loading branch information...
Antonio Alonso Dominguez
Antonio Alonso Dominguez committed Nov 1, 2017
1 parent 6d05a91 commit 2c7a6b0da5dc7568390de34466e3fcfd71b1b1c0
@@ -11,7 +11,7 @@ scala:

cache:
directories:
- $HOME/.sbt/0.13/dependency
- $HOME/.sbt/1.0/dependency
- $HOME/.sbt/boot/scala*
- $HOME/.sbt/launchers
- $HOME/.ivy2/cache
@@ -86,7 +86,7 @@ object Dependencies {
val bootstrap = "3.3.7"
val bootstrapNotifiy = "3.1.3"
val reactJs = "15.6.1"
val sparkMD5 = "2.0.2"
val sparkMD5 = "3.0.0"
val codemirror = "5.24.2"
}

@@ -21,11 +21,8 @@ import scala.scalajs.js.typedarray._
object MD5 {

// $COVERAGE-OFF$
def checksum(input: String): String = {
val buffer = new SparkMD5.ArrayBuffer()
buffer.append(input.getBytes("UTF-8").toTypedArray.buffer)
buffer.end()
}
def checksum(input: String): String =
SparkMD5.hash(input)
// $COVERAGE-ON$

}
@@ -23,6 +23,8 @@ import scala.scalajs.js.annotation._
@JSGlobal
object SparkMD5 extends js.Object {

def hash(str: String, raw: Boolean = false): String = js.native

@js.native
class ArrayBuffer() extends js.Object {
def append(chunk: js.typedarray.ArrayBuffer): Unit = js.native

0 comments on commit 2c7a6b0

Please sign in to comment.
You can’t perform that action at this time.