mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 08:37:05 +00:00
add licensing for urkit
This commit is contained in:
@@ -10,6 +10,9 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class Bytewords {
|
||||
public static final String BYTEWORDS = "ableacidalsoapexaquaarchatomauntawayaxisbackbaldbarnbeltbetabiasbluebodybragbrewbulbbuzzcalmcashcatschefcityclawcodecolacookcostcruxcurlcuspcyandarkdatadaysdelidicedietdoordowndrawdropdrumdulldutyeacheasyechoedgeepicevenexamexiteyesfactfairfernfigsfilmfishfizzflapflewfluxfoxyfreefrogfuelfundgalagamegeargemsgiftgirlglowgoodgraygrimgurugushgyrohalfhanghardhawkheathelphighhillholyhopehornhutsicedideaidleinchinkyintoirisironitemjadejazzjoinjoltjowljudojugsjumpjunkjurykeepkenokeptkeyskickkilnkingkitekiwiknoblamblavalazyleaflegsliarlistlimplionlogoloudloveluaulucklungmainmanymathmazememomenumeowmildmintmissmonknailnavyneednewsnextnoonnotenumbobeyoboeomitonyxopenovalowlspaidpartpeckplaypluspoempoolposepuffpumapurrquadquizraceramprealredorichroadrockroofrubyruinrunsrustsafesagascarsetssilkskewslotsoapsolosongstubsurfswantacotasktaxitenttiedtimetinytoiltombtoystriptunatwinuglyundouniturgeuservastveryvetovialvibeviewvisavoidvowswallwandwarmwaspwavewaxywebswhatwhenwhizwolfworkyankyawnyellyogayurtzapszestzinczonezoomzero";
|
||||
private static final List<String> bytewordsList;
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.sparrowwallet.sparrow.ur;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class UR {
|
||||
private final String type;
|
||||
private final byte[] data;
|
||||
|
||||
@@ -9,6 +9,9 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class URDecoder {
|
||||
private static final Pattern SEQUENCE_COMPONENT_PATTERN = Pattern.compile("(\\d+)-(\\d+)");
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class UREncoder {
|
||||
private final UR ur;
|
||||
private final FountainEncoder fountainEncoder;
|
||||
|
||||
@@ -10,6 +10,9 @@ import java.util.zip.CRC32;
|
||||
|
||||
import static com.sparrowwallet.sparrow.ur.fountain.FountainUtils.chooseFragments;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class FountainDecoder {
|
||||
private final Set<Integer> recievedPartIndexes = new TreeSet<>();
|
||||
private Set<Integer> lastPartIndexes;
|
||||
|
||||
@@ -18,6 +18,9 @@ import java.util.zip.CRC32;
|
||||
|
||||
import static com.sparrowwallet.sparrow.ur.fountain.FountainUtils.chooseFragments;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class FountainEncoder {
|
||||
private final int messageLen;
|
||||
private final long checksum;
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* Ported from https://github.com/BlockchainCommons/URKit
|
||||
*/
|
||||
public class FountainUtils {
|
||||
static List<Integer> chooseFragments(long seqNum, int seqLen, long checkSum) {
|
||||
// The first `seqLen` parts are the "pure" fragments, not mixed with any
|
||||
|
||||
Reference in New Issue
Block a user