From 0b12ba0ca00f7cdfb50b614fb24b673fb7e4e322 Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Fri, 14 Jul 2023 07:25:31 -0700 Subject: initial code --- example/test_files/hasheq | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 example/test_files/hasheq (limited to 'example/test_files/hasheq') diff --git a/example/test_files/hasheq b/example/test_files/hasheq new file mode 100644 index 0000000..702c17d --- /dev/null +++ b/example/test_files/hasheq @@ -0,0 +1,31 @@ +; find inputs that hash to the same thing under +; https://doc.riot-os.org/group__sys__hashes__djb2.html +; and +; https://doc.riot-os.org/group__sys__hashes__sdbm.html + +mov hash1 $123456 +mov hash2 $789012 +mov same_found $0 + +mov i $0 +label loop + load next_word i + + ; djb2 iteration + mul hash1 $33 + xor hash1 next_word + + ; sdbm iteration + mul hash2 $65599 + add hash2 next_word + + ; compare + mov are_eq hash1 + eq are_eq hash2 + + add i $1 + ite are_eq hashes_same loop + +label hashes_same + mov same_found $1 +end -- cgit v1.2.3