Skip to content

Instantly share code, notes, and snippets.

@chemacortes
Created February 11, 2026 10:04
Show Gist options
  • Select an option

  • Save chemacortes/278cb597d8e001001103d87dd7e670a6 to your computer and use it in GitHub Desktop.

Select an option

Save chemacortes/278cb597d8e001001103d87dd7e670a6 to your computer and use it in GitHub Desktop.
Crear el hash SHA-1 de una cadena de caracteres en scala
import java.security.MessageDigest
def sha1(text: String): String =
val bytes = text.getBytes("UTF-8")
MessageDigest
.getInstance("SHA-1")
.digest(bytes)
.map("%02x".format(_))
.mkString
@main def main(text: String): Unit =
println(sha1(text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment