Skip to content

Latest commit

 

History

History
14 lines (13 loc) · 527 Bytes

README.md

File metadata and controls

14 lines (13 loc) · 527 Bytes

crcKalc

Kotlin Multiplatform implementation for CRC calculator

Usage

fun main(args: Array<String>){
    val bytes = "123456789".toByteArray(java.nio.charset.Charset.forName("ASCII"))
    val params = com.crccalc.predefined.Crc8.maxim
    val crc = com.crccalc.CrcCalculator(params).calculateCrc(bytes)
    val resultHex = crc.toString(16).toUpperCase()
    val expectHex = params.check.toString(16).toUpperCase()
    println("crc for ${bytes.contentToString()} is 0x$resultHex and should be 0x$expectHex")
}