Login
7 branches 0 tags
Ben (X13/Arch) Removed [for] (use [dotimes] instead) e26057c 3 years ago 711 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]
      [dotimes [i [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]]]