Skip to content

Commit

Permalink
Remove hashes and ripemd160 module and replace with org.komputing.khash
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Nov 12, 2019
1 parent 9b4e405 commit fc287df
Show file tree
Hide file tree
Showing 23 changed files with 19 additions and 1,057 deletions.
4 changes: 2 additions & 2 deletions base58/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
implementation project(path: ':hashes')
testImplementation "com.github.komputing:khex:$khex_version"
implementation "com.github.komputing.khash:sha256:$khash_version"

testImplementation "com.github.komputing:khex:$khex_version"
}
3 changes: 2 additions & 1 deletion base58/src/main/kotlin/org/kethereum/encodings/Base58.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

package org.kethereum.encodings

import org.komputing.khash.sha256.extensions.sha256

/**
* Base58 is a way to encode addresses (or arbitrary data) as alphanumeric strings.
* Compared to base64, this encoding eliminates ambiguities created by O0Il and potential splits from punctuation
Expand All @@ -16,7 +18,6 @@ package org.kethereum.encodings
*
*/

import org.kethereum.hashes.sha256

private const val ENCODED_ZERO = '1'
private const val CHECKSUM_SIZE = 4
Expand Down
4 changes: 3 additions & 1 deletion bip32/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ dependencies {
implementation project(path: ':base58')
implementation project(path: ':crypto')
implementation project(path: ':crypto_api')
implementation project(path: ':hashes')
implementation project(path: ':extensions')
implementation project(path: ':model')

implementation "com.github.komputing.khash:sha256:$khash_version"
implementation "com.github.komputing.khash:ripemd160:$khash_version"

testImplementation "com.github.komputing:khex:$khex_version"
testImplementation project(path: ':crypto_impl_bouncycastle')

Expand Down
6 changes: 3 additions & 3 deletions bip32/src/main/kotlin/org/kethereum/bip32/BIP32.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import org.kethereum.bip44.BIP44
import org.kethereum.bip44.BIP44Element
import org.kethereum.crypto.*
import org.kethereum.extensions.toBytesPadded
import org.kethereum.hashes.ripemd160
import org.kethereum.hashes.sha256
import org.kethereum.model.ECKeyPair
import org.kethereum.model.PRIVATE_KEY_SIZE
import org.kethereum.model.PrivateKey
import org.komputing.khash.ripemd160.extensions.digestRipemd160
import org.komputing.khash.sha256.extensions.sha256
import java.math.BigInteger
import java.nio.ByteBuffer
import java.nio.ByteOrder
Expand All @@ -35,7 +35,7 @@ fun Seed.toKey(pathString: String, testnet: Boolean = false) = BIP44(pathString)
private fun ECKeyPair.computeFingerPrint(): Int {
val pubKeyHash = getCompressedPublicKey()
.sha256()
.ripemd160()
.digestRipemd160()
var fingerprint = 0
for (i in 0..3) {
fingerprint = fingerprint shl 8
Expand Down
2 changes: 1 addition & 1 deletion bip39/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
dependencies {
implementation project(path: ':bip32')
implementation project(path: ':extensions')
implementation project(path: ':hashes')
implementation project(path: ':crypto')
implementation project(path: ':crypto_api')

implementation "com.github.komputing:khex:$khex_version"
implementation "com.github.komputing.khash:sha256:$khash_version"

testImplementation project(path: ':bip39_wordlist_en')
testImplementation project(path: ':crypto_impl_spongycastle')
Expand Down
2 changes: 1 addition & 1 deletion bip39/src/main/kotlin/org/kethereum/bip39/Mnemonic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.kethereum.bip39.model.MnemonicWords
import org.kethereum.crypto.CryptoAPI
import org.kethereum.extensions.toBitArray
import org.kethereum.extensions.toByteArray
import org.kethereum.hashes.sha256
import org.komputing.khash.sha256.extensions.sha256
import java.security.SecureRandom
import java.util.*

Expand Down
2 changes: 1 addition & 1 deletion bloomfilter/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
implementation project(":hashes")
implementation "com.github.komputing.khash:sha256:$khash_version"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.kethereum.bloomfilter

import org.kethereum.hashes.sha256
import org.komputing.khash.sha256.extensions.sha256
import java.math.BigInteger
import java.util.BitSet
import java.util.*
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.read
import kotlin.concurrent.write
Expand Down
6 changes: 3 additions & 3 deletions crypto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ dependencies {
implementation project(":model")
implementation project(":functions")
implementation project(":keccak_shortcut")
implementation project(":hashes")
implementation project(":extensions")
implementation project(":crypto_api")

implementation "com.github.komputing:khex:$khex_version"

implementation "org.slf4j:slf4j-api:$slf4jVersion"

implementation project(":test_data")
testImplementation project(":test_data")
testImplementation "com.github.komputing.khash:sha256:$khash_version"
testImplementation project(":crypto_impl_spongycastle")
}
2 changes: 1 addition & 1 deletion crypto/src/test/kotlin/org/kethereum/crypto/SignTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import org.kethereum.crypto.test_data.PRIVATE_KEY
import org.kethereum.crypto.test_data.PUBLIC_KEY
import org.kethereum.crypto.test_data.TEST_MESSAGE
import org.kethereum.extensions.hexToBigInteger
import org.kethereum.hashes.sha256
import org.kethereum.model.PrivateKey
import org.kethereum.model.SignatureData
import org.komputing.khash.sha256.extensions.sha256
import org.walleth.khex.hexToByteArray
import java.security.SignatureException

Expand Down
1 change: 0 additions & 1 deletion hashes/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions hashes/build.gradle

This file was deleted.

85 changes: 0 additions & 85 deletions hashes/src/main/kotlin/org/kethereum/hashes/ArrayExtensions.kt

This file was deleted.

12 changes: 0 additions & 12 deletions hashes/src/main/kotlin/org/kethereum/hashes/ByteExtensions.kt

This file was deleted.

7 changes: 0 additions & 7 deletions hashes/src/main/kotlin/org/kethereum/hashes/Hashes.kt

This file was deleted.

27 changes: 0 additions & 27 deletions hashes/src/main/kotlin/org/kethereum/hashes/IntExtensions.kt

This file was deleted.

Loading

0 comments on commit fc287df

Please sign in to comment.