File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 66 DeflaterInputStream
77 Deflater
88 ZipException
9- CRC32)
9+ CRC32 CRC32C )
1010 (zlib_tiny CRC64)
1111 (org.apache.commons.io IOUtils)
1212 (java.security MessageDigest)
100100 ^Long [^bytes b]
101101 (wrap-crc CRC32 b))
102102
103+ (defn crc32c
104+ ^Long [^bytes b]
105+ (wrap-crc CRC32C b))
106+
103107(defn crc64
104108 ^Long [^bytes b]
105109 (wrap-crc CRC64 b))
Original file line number Diff line number Diff line change 66(def test-string " test it!" )
77
88(deftest checksums
9- (testing " CRC32"
10- (is (= 3421780262 (crc32 (.getBytes " 123456789" )))))
11- (testing " CRC64"
12- (is (= -7395533204333446662 (crc64 (.getBytes " 123456789" ))))))
9+ (let [input " 123456789"
10+ bs (.getBytes input)]
11+ (println " Test input string:" input)
12+ (println " Test input bytes:" (hexlify bs))
13+ (testing " CRC32"
14+ (println " CRC32 checks:" )
15+ (is (= 3421780262 (time (crc32 bs))) " CRC32 mismatch" ))
16+ (testing " CRC32C"
17+ (println " CRC32C checks:" )
18+ (is (= 3808858755 (time (crc32c bs))) " CRC32C mismatch" ))
19+ (testing " CRC64"
20+ (println " CRC64 checks:" )
21+ (is (= -7395533204333446662 (time (crc64 bs))) " CRC64 mismatch" ))))
1322
1423(deftest digests
1524 (testing " MD5"
You can’t perform that action at this time.
0 commit comments