Login
7 branches 0 tags
Ben (X13/Arch) Fixed [describe] for NFuncs 18f6460 3 years ago 707 Commits
nujel / stdlib / hash / hash.nuj
;; Nujel - Copyright (C) 2020-2021 - Benjamin Vincent Schulenburg
;; This project uses the MIT license, a copy should be included under /LICENSE
;;
;; Contains various implementations for various hashing functions

[defn hash/adler32 [data]
      [def a 1]
      [def b 0]
      [for [i 0 [string/length data]]
        [set! a [mod/int [add/int a [char-at data i]] 65521]]
        [set! b [mod/int [add/int a b] 65521]]]
      [logior a [ash b 16]]]