blob: 702c17d2219abe24c02b00a4c016a6b28207ef62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
|