Login
7 branches 0 tags
Ben (Win10) Fixed clang fb81367 3 years ago 624 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]]]