New try to add the ripemd160.fun library, but the new class is still broken. (0.37.39)
This commit is contained in:
parent
1f6bc2b96a
commit
8b04622e55
3 changed files with 353 additions and 1 deletions
36
examples/ripemd160_example.fun
Normal file
36
examples/ripemd160_example.fun
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2026-01-02
|
||||
*/
|
||||
|
||||
// THIS IS BROKEN ACTUALLY! IT DOES NOT CALCULATE THE EXPECTED HASHES!
|
||||
|
||||
/*
|
||||
* Example: Using RIPEMD160 from lib/crypt/ripemd160.fun
|
||||
*
|
||||
* Known vectors:
|
||||
* - "" (empty) => 9c1185a5c5e9fc54612808977ee8f548b2258d31
|
||||
* - "abc" => 8eb208f7e05d987a9b04... (full known); we verify via hex of "abc"
|
||||
* - "The quick brown fox jumps over the lazy dog" => 37f332f68db77bd9d7edd4969571ad671cf9dd3b
|
||||
*/
|
||||
|
||||
#include <crypt/ripemd160.fun>
|
||||
|
||||
r = RIPEMD160()
|
||||
|
||||
// empty string
|
||||
print(r.ripemd160_str(""))
|
||||
|
||||
// "abc"
|
||||
print(r.ripemd160_hex("616263"))
|
||||
|
||||
// pangram
|
||||
print(r.ripemd160_str("The quick brown fox jumps over the lazy dog"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue