Skip to content

Commit

Permalink
package name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Oct 31, 2017
1 parent e7449f7 commit 36a0688
Show file tree
Hide file tree
Showing 510 changed files with 3,872 additions and 3,285 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ after_success:

notifications:
irc:
channels: "irc.freenode.net#bitcoinj"
channels: "irc.freenode.net#pivxj"
skip_join: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ If you send coins to that address, it will forward them on to the address you sp

```
cd examples
mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.ForwardingService -Dexec.args="<insert a bitcoin address here>"
mvn exec:java -Dexec.mainClass=org.pivxj.examples.ForwardingService -Dexec.args="<insert a bitcoin address here>"
```

Note that this example app *does not use checkpointing*, so the initial chain sync will be pretty slow. You can make an app that starts up and does the initial sync much faster by including a checkpoints file; see the documentation for
Expand Down
Binary file added core/.DS_Store
Binary file not shown.
411 changes: 411 additions & 0 deletions core/1.01_pivx-wallet-backup_org.pivx.production-2017-07-26 (2)

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/findbugs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<FindBugsFilter>
<Match>
<!-- Protos and inner classes are generated by the proto compiler -->
<Package name="org.bitcoinj.protos"/>
<Package name="org.pivxj.protos"/>
<Package name="org.bitcoin.protocols.payments"/>
</Match>

<!-- bitcoinj is not designed to run in an environment with malicious code loaded into the VM -->
<pivxjoinj is not designed to run in an environment with malicious code loaded into the VM -->
<Match>
<Bug category="MALICIOUS_CODE"/>
</Match>
Expand All @@ -38,7 +38,7 @@
<!-- The code is correct but findbugs can't analyze it properly -->
<Match>
<Bug code="SF"/>
<Class name="org.bitcoinj.core.BloomFilter"/>
<Class name="org.pivxj.core.BloomFilter"/>
</Match>

<!-- fb doesn't like the odd API this class has -->
Expand Down
Binary file added core/src/.DS_Store
Binary file not shown.
Binary file added core/src/main/.DS_Store
Binary file not shown.
Binary file added core/src/main/java/.DS_Store
Binary file not shown.
Binary file added core/src/main/java/com/.DS_Store
Binary file not shown.
Binary file not shown.
199 changes: 199 additions & 0 deletions core/src/main/java/com/hashengineering/crypto/Hash9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
/*
* Copyright 2014 Hash Engineering Solutions.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hashengineering.crypto;

import fr.cryptohash.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.hashengineering.utils.ByteArrayUtils.trim256;

/**
* Created by Hash Engineering Solutions 2/18/14.
*
* This class implements the Quark Proof Of Work hashing function,
* which is also used as the block hash
*
*/

public class Hash9 extends HashFunction {
private static final Logger log = LoggerFactory.getLogger(Hash9.class);

static BLAKE512 blake512;
static BMW512 bmw512;
static Groestl512 groestl512;
static Skein512 skein512;
static JH512 jh512;
static Keccak512 keccak512;

static {
loadNativeLibrary("hash9");

//if(native_library_loaded == false)
{
blake512 = new BLAKE512();
bmw512 = new BMW512();
groestl512 = new Groestl512();
skein512 = new Skein512();
jh512 = new JH512();
keccak512 = new Keccak512();
}
}

public static byte[] digest(byte[] input, int offset, int length)
{
try {
/*byte [] result = null;
long start = System.currentTimeMillis();
result = hash9(input, 0, input.length);
timeJ2 += System.currentTimeMillis() - start;
start = System.currentTimeMillis();
result = hash9_native(input, 0, input.length);
timeN2 += System.currentTimeMillis() - start;
if(count2 == 100)
{
log.info("[stats] Quark Java New: "+ timeJ2);
log.info("[stats] Quark Native: "+ timeN2);
count2 = 0;
timeJ2 = timeN2 = 0;
}
count2++;
return result;*/
return native_library_loaded ? hash9_native(input, offset, length) : hash9(input, offset, length);
}
catch(Exception e) {
return null;
}
}

static long timeJ = 0;
static long timeN = 0;
static long timeNO = 0;
static int count = 0;
static long timeJ2 = 0;
static long timeN2 = 0;
static int count2 = 0;

public static byte[] digest(byte[] input) {

try {
/*
byte [] result = null;
long start = System.currentTimeMillis();
result = hash9(input, 0, input.length);
timeJ += System.currentTimeMillis() - start;
start = System.currentTimeMillis();
result = hash9_native_old(input);
timeNO += System.currentTimeMillis() - start;
start = System.currentTimeMillis();
result = hash9_native(input, 0, input.length);
timeN += System.currentTimeMillis() - start;
if(count == 100)
{
log.info("[stats] Quark Java New: "+ timeJ);
log.info("[stats] Quark Native: "+ timeN);
log.info("[stats] Quark Native Old: "+ timeNO);
count = 0;
timeJ = timeN = timeNO = 0;
}
count++;
return result;*/
return native_library_loaded ? hash9_native(input, 0, input.length) : hash9(input, 0, input.length);
} catch (Exception e) {
return null;
}
}

static native byte [] hash9_native(byte [] input, int offset, int length);
static native byte [] hash9_native_old(byte [] input);

static byte [] hash9(byte header[])
{
return hash9(header, 0, header.length);
}
/*
Java implimentation of the Quark Hashing Algorithm.
It consists of 6 of the SHA-3 candidates. There are 9 rounds.
Every third round is a "random" hash based on the
0x8 bit of the first byte of the previous hash.
The hashes are all calculated to result with 512 bits (64 bytes).
The result returned is the first 32 bytes.
Order:
blake
bmw
(groestl or skein)
groestl
jh
(blake or bmw)
keccak
skein
(keccak or jh)
*/
static byte [] hash9(byte [] header, int offset, int length)
{
byte [][] hash = new byte[9][];


blake512.update(header, offset, length);

hash[0] = blake512.digest();

hash[1] = bmw512.digest(hash[0]);

if((hash[1][0] & 8) != 0)
{
hash[2] = groestl512.digest(hash[1]);
}
else
{
hash[2] = skein512.digest(hash[1]);
}

hash[3] = groestl512.digest(hash[2]);

hash[4] = jh512.digest(hash[3]);

if((hash[4][0] & 8) != 0)
{
hash[5] = blake512.digest(hash[4]);
}
else
{
hash[5] = bmw512.digest(hash[4]);
}

hash[6] = keccak512.digest(hash[5]);

hash[7] = skein512.digest(hash[6]);

if((hash[7][0] & 8) != 0)
{
hash[8] = keccak512.digest(hash[7]);
}
else
{
hash[8] = jh512.digest(hash[7]);
}

return trim256(hash[8]);
}



}
24 changes: 24 additions & 0 deletions core/src/main/java/com/hashengineering/crypto/HashFunction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.hashengineering.crypto;

/**
* Created by Eric on 7/2/14.
*/
public class HashFunction {
protected static boolean native_library_loaded = false;

static void loadNativeLibrary(String name)
{
try {
System.loadLibrary(name);
native_library_loaded = true;
}
catch(UnsatisfiedLinkError e)
{
native_library_loaded = false;
}
catch(Exception e)
{
native_library_loaded = false;
}
}
}
4 changes: 2 additions & 2 deletions core/src/main/java/com/hashengineering/crypto/Sha512Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package com.hashengineering.crypto;

import com.google.common.io.ByteStreams;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.Utils;
import org.pivxj.core.Sha256Hash;
import org.pivxj.core.Utils;
import org.spongycastle.util.encoders.Hex;

import java.io.File;
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/com/hashengineering/crypto/X11.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.hashengineering.crypto;

import org.bitcoinj.core.Sha256Hash;

import fr.cryptohash.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
31 changes: 31 additions & 0 deletions core/src/main/java/com/hashengineering/utils/ByteArrayUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2014 Hash Engineering Solutions.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hashengineering.utils;

/**
* Created by HashEngineering on 7/2/14.
*/
public class ByteArrayUtils {

public static byte[] trim256(byte [] bytes)
{
byte [] result = new byte[32];
for (int i = 0; i < 32; i++){
result[i] = bytes[i];
}
return result;
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/bitcoin/NativeSecp256k1.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* <p>You can find an example library that can be used for this at https://github.com/bitcoin/secp256k1</p>
*
* <p>To build secp256k1 for use with bitcoinj, run
* <p>To build secp256k1 for use with pivxj, run
* `./configure --enable-jni --enable-experimental --enable-module-schnorr --enable-module-ecdh`
* and `make` then copy `.libs/libsecp256k1.so` to your system library path
* or point the JVM to the folder containing it with -Djava.library.path
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/darkcoinj/ActiveMasterNode.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.darkcoinj;

import org.bitcoinj.core.*;
import org.pivxj.core.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/darkcoinj/DarkSend.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.darkcoinj;

import org.bitcoinj.core.DarkSendQueue;
import org.bitcoinj.core.Sha256Hash;
import org.pivxj.core.DarkSendQueue;
import org.pivxj.core.Sha256Hash;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.darkcoinj;

import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionInput;
import org.pivxj.core.Transaction;
import org.pivxj.core.TransactionInput;

/**
* Created by Eric on 2/8/2015.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/darkcoinj/DarkSendEntry.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.darkcoinj;

import org.bitcoinj.core.*;
import org.pivxj.core.*;

import java.util.ArrayList;

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/darkcoinj/DarkSendEntryVin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.darkcoinj;

import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.TransactionInput;
import org.pivxj.core.NetworkParameters;
import org.pivxj.core.TransactionInput;

/**
* Created by Eric on 2/8/2015.
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/darkcoinj/DarkSendPool.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.darkcoinj;

import org.bitcoinj.core.*;
import org.bitcoinj.script.Script;
import org.bitcoinj.utils.ContextPropagatingThreadFactory;
import org.bitcoinj.utils.Threading;
import org.pivxj.core.*;
import org.pivxj.script.Script;
import org.pivxj.utils.ContextPropagatingThreadFactory;
import org.pivxj.utils.Threading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/darkcoinj/DarkSendSigner.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.darkcoinj;

import com.google.common.base.Charsets;
import org.bitcoinj.core.*;
import org.bitcoinj.crypto.KeyCrypterException;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptBuilder;
import org.pivxj.core.*;
import org.pivxj.crypto.KeyCrypterException;
import org.pivxj.script.Script;
import org.pivxj.script.ScriptBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Base64;
Expand Down
Loading

0 comments on commit 36a0688

Please sign in to comment.