1
0
Fork 0
forked from fun/fun

Some more stdlib refactoring removing duplicate code. (0.38.9)

This commit is contained in:
Johannes Findeisen 2026-02-09 01:02:49 +01:00
commit 794a2354d6
11 changed files with 18 additions and 112 deletions

View file

@ -53,19 +53,11 @@ class SHA1()
i = i + 2
return arr
fun two_hex(this, n)
n = n % 256
d = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
hi = n / 16
lo = n % 16
parts = [d[hi], d[lo]]
return join(parts, "")
fun bytes_to_hex(this, arr)
i = 0
out = []
while i < len(arr)
push(out, this.two_hex(arr[i]))
push(out, two_hex(arr[i]))
i = i + 1
return join(out, "")