io.github.binaryfoo.hex.HexDumpElement.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of emv-bertlv Show documentation
Show all versions of emv-bertlv Show documentation
Some decoders for the data used in EMV credit card transactions.
package io.github.binaryfoo.hex
import java.util.*
import kotlin.text.substring
data class HexDumpElement(val value: String, val byteOffset: Int) {
companion object {
@JvmStatic fun splitIntoByteLengthStrings(hexString: String, startIndexInBytes: Int): List {
val elements = ArrayList()
var byteOffset = startIndexInBytes
for (i in 0..hexString.length-2 step 2) {
elements.add(HexDumpElement(hexString.substring(i, i + 2), byteOffset++))
}
return elements
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy