Skip to content

Commit

Permalink
Add method to represent SignatureData as hex
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Jan 2, 2019
1 parent 5b85bdf commit bc570c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crypto/src/main/kotlin/org/kethereum/crypto/Signatures.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.kethereum.crypto

import org.kethereum.extensions.toHexStringZeroPadded
import org.kethereum.model.SignatureData
import org.walleth.khex.toHexString
import java.math.BigInteger

fun SignatureData.toHex() = r.to64BytePaddedHex() + s.to64BytePaddedHex() + v.toHexString()

private fun BigInteger.to64BytePaddedHex() = toHexStringZeroPadded(64, false)

0 comments on commit bc570c3

Please sign in to comment.