The foundation for the internal standard library. (0.16.2)
This commit is contained in:
parent
71682293fe
commit
f0ed1d6761
13 changed files with 88 additions and 197 deletions
|
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://hanez.org/project/fun/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-09-29
|
||||
*/
|
||||
|
||||
// Include the pure Fun CRC32 library
|
||||
include "lib/crypt/crc32.fun"
|
||||
|
||||
// Create a Class-typed instance to prevent accidental shadowing
|
||||
Class c32 = CRC32()
|
||||
print(typeof(c32)) // should be "Class"
|
||||
|
||||
print("=== CRC32 demo (hex input) ===")
|
||||
|
||||
// "" (empty) -> 00000000
|
||||
print(c32.crc32_hex(""))
|
||||
|
||||
// "abc" -> 352441c2
|
||||
print(c32.crc32_hex("616263"))
|
||||
|
||||
// "123456789" -> cbf43926
|
||||
print(c32.crc32_hex("313233343536373839"))
|
||||
|
||||
print("=== Done ===")
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
// Include the pure Fun MD5 library
|
||||
include "lib/crypt/md5.fun"
|
||||
include <crypt/md5.fun>
|
||||
|
||||
// create a hasher instance
|
||||
md5 = MD5()
|
||||
|
|
@ -31,4 +31,7 @@ print(md5.md5_hex("6d65737361676520646967657374")) // -> f96b697d7cb7938d525a2f
|
|||
// "abcdefghijklmnopqrstuvwxyz"
|
||||
print(md5.md5_hex("6162636465666768696a6b6c6d6e6f707172737475767778797a")) // -> c3fcd3d76192e4007dfb496cca67e13b
|
||||
|
||||
// "Have Fun!"
|
||||
print(md5.md5_str("Have Fun!")) // ->
|
||||
|
||||
print("=== Done ===")
|
||||
|
|
|
|||
0
examples/sha1_demo.fun
Normal file → Executable file
0
examples/sha1_demo.fun
Normal file → Executable file
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
// Include the pure Fun SHA-256 library
|
||||
include "lib/crypt/sha256.fun"
|
||||
include <crypt/sha256.fun>
|
||||
|
||||
sha = SHA256()
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
// Demo: SHA-256 of raw strings (no hex decoding)
|
||||
include "lib/crypt/sha256.fun"
|
||||
include <crypt/sha256.fun>
|
||||
|
||||
sha = SHA256()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* Added: 2025-09-29
|
||||
*/
|
||||
|
||||
include "lib/crypt/sha512.fun"
|
||||
include <crypt/sha512.fun>
|
||||
|
||||
sha = SHA512()
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
// Demo: SHA-512 of raw strings (no hex decoding)
|
||||
include "lib/crypt/sha512.fun"
|
||||
include <crypt/sha512.fun>
|
||||
|
||||
sha = SHA512()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue