Last active
April 7, 2024 18:01
-
-
Save varantes/0ff5a120a4e56be3057d8dfd89678e07 to your computer and use it in GitHub Desktop.
Generates CRC32 hash for image files using Kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.Files | |
import java.nio.file.Paths | |
import java.util.zip.* | |
val crc32 = CRC32() | |
crc32.update(Files.readAllBytes(Paths.get("C:\\Users\\valdemar.neto\\Documents\\Certibio\\temp\\1\\data_10.png"))) | |
val crc10 = crc32.value | |
crc32.reset() | |
crc32.update(Files.readAllBytes(Paths.get("C:\\Users\\valdemar.neto\\Documents\\Certibio\\temp\\1\\data_11.png"))) | |
val crc11 = crc32.value | |
crc32.reset() | |
crc32.update(Files.readAllBytes(Paths.get("C:\\Users\\valdemar.neto\\Documents\\Certibio\\temp\\1\\data_12.png"))) | |
val crc12 = crc32.value | |
println("$crc10 $crc11 $crc12") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment