More OpenSSL and documenation fun. No more words to say. (0.38.13)
This commit is contained in:
parent
53698478d9
commit
38968a9a51
33 changed files with 498 additions and 88 deletions
28
examples/crypto/openssl_sha256.fun
Normal file
28
examples/crypto/openssl_sha256.fun
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/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
|
||||
*/
|
||||
|
||||
// OpenSSL SHA-256 example
|
||||
// Enable with -DFUN_WITH_OPENSSL=ON during build for real hashing.
|
||||
|
||||
s = "abc"
|
||||
d = openssl_sha256(s)
|
||||
print("sha256(abc) = " + d)
|
||||
|
||||
// Another quick check (empty string)
|
||||
e = ""
|
||||
print("sha256(\"\") = " + openssl_sha256(e))
|
||||
|
||||
/* Expected output:
|
||||
sha256(abc) = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
|
||||
sha256("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
*/
|
||||
28
examples/crypto/openssl_sha512.fun
Normal file
28
examples/crypto/openssl_sha512.fun
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/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
|
||||
*/
|
||||
|
||||
// OpenSSL SHA-512 example
|
||||
// Enable with -DFUN_WITH_OPENSSL=ON during build for real hashing.
|
||||
|
||||
s = "abc"
|
||||
d = openssl_sha512(s)
|
||||
print("sha512(abc) = " + d)
|
||||
|
||||
// Another quick check (empty string)
|
||||
e = ""
|
||||
print("sha512(\"\") = " + openssl_sha512(e))
|
||||
|
||||
/* Expected output:
|
||||
sha512(abc) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
|
||||
sha512("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue