dedipresta / scala-crypto   1.0.0

MIT License GitHub

Dependency free implementation of cryptographic hash functions for Scala and Scala.js

Scala versions: 2.13 2.12
Scala.js versions: 1.x

SCALA-CRYPTO

Scala 2.12 Scala 2.13 Scala.js License: MIT version Codecov made with love

Scala Crypto is a dependency free implementation of cryptographic hash functions.

It targets Scala and Scala.js.

Why Scala Crypto ?

All Scala SHA-256 hash libraries rely on Java libraries, especially java.security.MessageDigest and thus cannot be used in the context of a scala.js application or library. Having a dependency free library allows to publish for other platforms than JVM and in addition to scala.js this library will be published to scala-native once support for Scala 2.12 and 2.13 will be available.

Supported algorithms

Supported algorithms Information
SHA-256 Inspired by java implementation meyfa/java-sha256
SHA-512

How to use

Add to your sbt project:

Scala:

libraryDependencies += "com.dedipresta" %% "scala-crypto" % "1.0.0"

Scala.js:

libraryDependencies += "com.dedipresta" %%% "scala-crypto" % "1.0.0"

Then you may hash your String or Array[Byte]:

import com.dedipresta.crypto.hash.sha256.Sha256
Sha256.hash("Hello world!") // to get an array of bytes
Sha256.hashString("Scala.js!") // 25ed477793a2663fc5173a24f1a1f0750d5bd7f577dabee09452d82d3caff0e2

Copyright and License

All code is available to you under the MIT license, available at https://opensource.org/licenses/MIT and also in the LICENSE file.