Created
February 11, 2026 10:04
-
-
Save chemacortes/278cb597d8e001001103d87dd7e670a6 to your computer and use it in GitHub Desktop.
Crear el hash SHA-1 de una cadena de caracteres en scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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