1
0
Fork 0
forked from fun/fun
fun/examples/crypto/libressl_sha512.fun

28 lines
847 B
Standard ML

#!/usr/bin/env fun
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2026 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*
* Added: 2026-02-19
*/
// LibreSSL SHA-512 example
// Enable with -DFUN_WITH_LIBRESSL=ON during build for real hashing.
s = "abc"
d = libressl_sha512(s)
print("sha512(abc) = " + d)
// Another quick check (empty string)
e = ""
print("sha512(\"\") = " + libressl_sha512(e))
/* Expected output:
sha512(abc) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
sha512("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
*/