mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2025-10-16 11:45:37 +00:00
fixed typos
This commit is contained in:
parent
cc1c17b703
commit
3a9ecf464a
@ -580,7 +580,7 @@ public class IotaAPI extends IotaAPICoreProxy {
|
||||
String trxTrytes = Converter.transactionTrytes(trx).substring(2187, 2187 + 162);
|
||||
//System.out.println("Bundlesize "+bundle.getTransactions().size()+" "+trxTrytes);
|
||||
// Absorb bundle hash + value + timestamp + lastIndex + currentIndex trytes.
|
||||
curl.absorbb(Converter.trits(trxTrytes));
|
||||
curl.absorb(Converter.trits(trxTrytes));
|
||||
// Check if input transaction
|
||||
if (bundleValue < 0) {
|
||||
String address = trx.getAddress();
|
||||
@ -605,7 +605,7 @@ public class IotaAPI extends IotaAPICoreProxy {
|
||||
// Check for total sum, if not equal 0 return error
|
||||
if (totalSum != 0) throw new InvalidBundleException("Invalid Bundle Sum");
|
||||
int[] bundleFromTrxs = new int[243];
|
||||
curl.squeezee(bundleFromTrxs);
|
||||
curl.squeeze(bundleFromTrxs);
|
||||
String bundleFromTxString = Converter.trytes(bundleFromTrxs);
|
||||
|
||||
// Check if bundle hash is the same as returned by tx object
|
||||
|
||||
@ -68,11 +68,11 @@ public class Bundle implements Comparable<Bundle> {
|
||||
|
||||
|
||||
int[] t = Converter.trits(this.getTransactions().get(i).getAddress() + Converter.trytes(valueTrits) + this.getTransactions().get(i).getTag() + Converter.trytes(timestampTrits) + Converter.trytes(currentIndexTrits) + Converter.trytes(lastIndexTrits));
|
||||
curl.absorbb(t, 0, t.length);
|
||||
curl.absorb(t, 0, t.length);
|
||||
}
|
||||
|
||||
int[] hash = new int[243];
|
||||
curl.squeezee(hash, 0, hash.length);
|
||||
curl.squeeze(hash, 0, hash.length);
|
||||
String hashInTrytes = Converter.trytes(hash);
|
||||
|
||||
for (int i = 0; i < this.getTransactions().size(); i++) {
|
||||
|
||||
@ -4,13 +4,13 @@ package jota.pow;
|
||||
* Created by Adrian on 07.01.2017.
|
||||
*/
|
||||
public interface ICurl {
|
||||
JCurl absorbb(final int[] trits, int offset, int length);
|
||||
JCurl absorb(final int[] trits, int offset, int length);
|
||||
|
||||
JCurl absorbb(final int[] trits);
|
||||
JCurl absorb(final int[] trits);
|
||||
|
||||
int[] squeezee(final int[] trits, int offset, int length);
|
||||
int[] squeeze(final int[] trits, int offset, int length);
|
||||
|
||||
int[] squeezee(final int[] trits);
|
||||
int[] squeeze(final int[] trits);
|
||||
|
||||
JCurl transform();
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public class JCurl implements ICurl {
|
||||
|
||||
private int[] state = new int[STATE_LENGTH];
|
||||
|
||||
public JCurl absorbb(final int[] trits, int offset, int length) {
|
||||
public JCurl absorb(final int[] trits, int offset, int length) {
|
||||
|
||||
do {
|
||||
System.arraycopy(trits, offset, state, 0, length < HASH_LENGTH ? length : HASH_LENGTH);
|
||||
@ -28,8 +28,8 @@ public class JCurl implements ICurl {
|
||||
|
||||
|
||||
|
||||
public JCurl absorbb(final int[] trits) {
|
||||
return absorbb(trits, 0, trits.length);
|
||||
public JCurl absorb(final int[] trits) {
|
||||
return absorb(trits, 0, trits.length);
|
||||
}
|
||||
|
||||
public JCurl transform() {
|
||||
@ -52,7 +52,7 @@ public class JCurl implements ICurl {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int[] squeezee(final int[] trits, int offset, int length) {
|
||||
public int[] squeeze(final int[] trits, int offset, int length) {
|
||||
|
||||
do {
|
||||
System.arraycopy(state, 0, trits, offset, length < HASH_LENGTH ? length : HASH_LENGTH);
|
||||
@ -63,8 +63,8 @@ public class JCurl implements ICurl {
|
||||
return state;
|
||||
}
|
||||
|
||||
public int[] squeezee(final int[] trits) {
|
||||
return squeezee(trits, 0, trits.length);
|
||||
public int[] squeeze(final int[] trits) {
|
||||
return squeeze(trits, 0, trits.length);
|
||||
}
|
||||
|
||||
public int[] getState() {
|
||||
|
||||
@ -32,10 +32,10 @@ public class Signing {
|
||||
}
|
||||
|
||||
curl.reset();
|
||||
curl.absorbb(seed, 0, seed.length);
|
||||
curl.squeezee(seed, 0, seed.length);
|
||||
curl.absorb(seed, 0, seed.length);
|
||||
curl.squeeze(seed, 0, seed.length);
|
||||
curl.reset();
|
||||
curl.absorbb(seed, 0, seed.length);
|
||||
curl.absorb(seed, 0, seed.length);
|
||||
|
||||
final List<Integer> key = new ArrayList<>();
|
||||
int[] buffer = new int[seed.length];
|
||||
@ -44,7 +44,7 @@ public class Signing {
|
||||
while (length-- > 0) {
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
curl.squeezee(buffer, offset, buffer.length);
|
||||
curl.squeeze(buffer, offset, buffer.length);
|
||||
for (int j = 0; j < 243; j++) {
|
||||
key.add(buffer[j]);
|
||||
}
|
||||
@ -72,8 +72,8 @@ public class Signing {
|
||||
|
||||
for (int j = 0; j < 13 - normalizedBundleFragment[i]; j++) {
|
||||
curl.reset()
|
||||
.absorbb(hash, 0, hash.length)
|
||||
.squeezee(hash, 0, hash.length);
|
||||
.absorb(hash, 0, hash.length)
|
||||
.squeeze(hash, 0, hash.length);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 243; j++) {
|
||||
@ -87,8 +87,8 @@ public class Signing {
|
||||
public int[] address(int[] digests) {
|
||||
int[] address = new int[243];
|
||||
curl.reset()
|
||||
.absorbb(digests)
|
||||
.squeezee(address);
|
||||
.absorb(digests)
|
||||
.squeeze(address);
|
||||
return address;
|
||||
}
|
||||
|
||||
@ -105,15 +105,15 @@ public class Signing {
|
||||
buffer = Arrays.copyOfRange(keyFragment, j * 243, (j + 1) * 243);
|
||||
for (int k = 0; k < 26; k++) {
|
||||
curl.reset()
|
||||
.absorbb(buffer)
|
||||
.squeezee(buffer);
|
||||
.absorb(buffer)
|
||||
.squeeze(buffer);
|
||||
}
|
||||
System.arraycopy(buffer, 0, keyFragment, j * 243, 243);
|
||||
}
|
||||
|
||||
curl.reset();
|
||||
curl.absorbb(keyFragment, 0, keyFragment.length);
|
||||
curl.squeezee(buffer, 0, buffer.length);
|
||||
curl.absorb(keyFragment, 0, keyFragment.length);
|
||||
curl.squeeze(buffer, 0, buffer.length);
|
||||
|
||||
System.arraycopy(buffer, 0, digests, i * 243, 243);
|
||||
}
|
||||
@ -131,12 +131,12 @@ public class Signing {
|
||||
|
||||
ICurl jCurl = new JCurl();
|
||||
jCurl.reset();
|
||||
jCurl.absorbb(buffer);
|
||||
jCurl.squeezee(buffer);
|
||||
jCurl.absorb(buffer);
|
||||
jCurl.squeeze(buffer);
|
||||
}
|
||||
curl.absorbb(buffer);
|
||||
curl.absorb(buffer);
|
||||
}
|
||||
curl.squeezee(buffer);
|
||||
curl.squeeze(buffer);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ public class TransactionConverter {
|
||||
|
||||
// generate the correct transaction hash
|
||||
curl.reset();
|
||||
curl.absorbb(transactionTrits, 0, transactionTrits.length);
|
||||
curl.squeezee(hash, 0, hash.length);
|
||||
curl.absorb(transactionTrits, 0, transactionTrits.length);
|
||||
curl.squeeze(hash, 0, hash.length);
|
||||
|
||||
Transaction trx = new Transaction();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user