https://github.com/dedipresta/scala-crypto
Dependency free implementation of cryptographic hash functions for Scala and Scala.js
https://github.com/dedipresta/scala-crypto
cryptography scala scalajs sha256
Last synced: 5 months ago
JSON representation
Dependency free implementation of cryptographic hash functions for Scala and Scala.js
- Host: GitHub
- URL: https://github.com/dedipresta/scala-crypto
- Owner: dedipresta
- License: mit
- Created: 2020-07-16T21:52:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-21T19:23:43.000Z (almost 6 years ago)
- Last Synced: 2025-10-21T07:39:30.616Z (8 months ago)
- Topics: cryptography, scala, scalajs, sha256
- Language: Scala
- Homepage:
- Size: 29.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SCALA-CRYPTO
[](https://www.scala-lang.org/)
[](https://www.scala-lang.org/)
[](https://www.scala-js.org)
[](https://opensource.org/licenses/MIT)

[](https://codecov.io/gh/dedipresta/scala-crypto)
[](https://www.dedipresta.com)
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](https://github.com/meyfa/java-sha256)|
| *SHA-512* |
## How to use
Add to your sbt project:
*Scala:*
```Scala
libraryDependencies += "com.dedipresta" %% "scala-crypto" % "1.0.0"
```
*Scala.js:*
```Scala
libraryDependencies += "com.dedipresta" %%% "scala-crypto" % "1.0.0"
```
Then you may hash your `String` or `Array[Byte]`:
```Scala
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](https://opensource.org/licenses/MIT) and also in the
[LICENSE](LICENSE) file.