Login
7 branches 0 tags
Ben (X13/Arch) Renamed bitwise operations to be Clojure compatible 4537f11 3 years ago 715 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]]]
      [bit-or a [bit-shift-left b 16]]]