dedipresta / scala-crypto   1.0.0

MIT License GitHub

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

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


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 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

How to use

Add to your sbt project:


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


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 and also in the LICENSE file.