From 7c621872e744e62c6efcc3fe5ae82c5428a62971 Mon Sep 17 00:00:00 2001 From: fluency03 Date: Sat, 12 May 2018 22:13:05 +0200 Subject: [PATCH] add tests for hash160ToAddress --- .../fluency03/blockchain/crypto/Secp256k1Test.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/scala/com/github/fluency03/blockchain/crypto/Secp256k1Test.scala b/src/test/scala/com/github/fluency03/blockchain/crypto/Secp256k1Test.scala index 8cc79f1..c4ecb43 100644 --- a/src/test/scala/com/github/fluency03/blockchain/crypto/Secp256k1Test.scala +++ b/src/test/scala/com/github/fluency03/blockchain/crypto/Secp256k1Test.scala @@ -36,9 +36,18 @@ class Secp256k1Test extends FlatSpec with Matchers { "4A2541129368D7D9BB05CD8AFBDF7705A6540D98028236965553F91BF1C5B4F70073F55B55D").address shouldEqual "1DU8Hi1sbHTpEP9vViBEkEw6noeUrgKkJH" + Secp256k1.hash160ToAddress("45590A0195EB451711B9D076E4C0CD04675AAD55") shouldEqual + "17KgHnGbu49vhav3ck7tjnBm9Lk9tpeLhX" + + Secp256k1.hash160ToAddress("88C2D2FA846282C870A76CADECBE45C4ACD72BB6") shouldEqual + "1DU8Hi1sbHTpEP9vViBEkEw6noeUrgKkJH" + Secp256k1.addressToHash160("1DU8Hi1sbHTpEP9vViBEkEw6noeUrgKkJH") shouldEqual ("00", "88C2D2FA846282C870A76CADECBE45C4ACD72BB6".toLowerCase) + Secp256k1.addressToHash160("17KgHnGbu49vhav3ck7tjnBm9Lk9tpeLhX") shouldEqual + ("00", "45590A0195EB451711B9D076E4C0CD04675AAD55".toLowerCase) + Secp256k1.privateKeyToBytes(pair.getPrivate).toBigInt shouldEqual Secp256k1.privateKeyToHex(pair.getPrivate).hex2BigInt }