forked from LimeChain/Fruzhin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
569 additions
and
79 deletions.
There are no files selected for viewing
10 changes: 8 additions & 2 deletions
10
src/main/java/com/limechain/chain/lightsyncstate/Authority.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
package com.limechain.chain.lightsyncstate; | ||
|
||
import com.limechain.teavm.annotation.Reflectable; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.io.Serializable; | ||
import java.math.BigInteger; | ||
|
||
@Getter | ||
@Setter | ||
@Reflectable | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Authority implements Serializable { | ||
private final byte[] publicKey; | ||
private final BigInteger weight; | ||
private byte[] publicKey; | ||
private BigInteger weight; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
package com.limechain.utils; | ||
|
||
import com.limechain.polkaj.Hash256; | ||
import lombok.experimental.UtilityClass; | ||
import org.teavm.jso.JSBody; | ||
import org.teavm.jso.core.JSString; | ||
|
||
@UtilityClass | ||
public class HashUtils { | ||
// public static final int HASH256_HASH_LENGTH = Hash256.SIZE_BYTES * Byte.SIZE; | ||
// | ||
// /** | ||
// * Conducts a 256-bit Blake2b hash. | ||
// * @param input the data to be hashed. | ||
// * @return byte array containing the 256-bit hash result. | ||
// */ | ||
// public static byte[] hashWithBlake2b(byte[] input) { | ||
// Blake2bDigest digest = new Blake2bDigest(HASH256_HASH_LENGTH); | ||
// digest.reset(); | ||
// digest.update(input, 0, input.length); | ||
// byte[] hash = new byte[digest.getDigestSize()]; | ||
// digest.doFinal(hash, 0); | ||
// return hash; | ||
// } | ||
|
||
@JSBody(params = {"inputHex"}, script = "{" + | ||
"let bytes = new Uint8Array([...inputHex.matchAll(/../g)].map(m => parseInt(m[0], 16)));" + | ||
"return Blake2b.hash(bytes,undefined,32);" + "}") | ||
public static native JSString hashWithBlake2b(String inputHex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.