add licensing for urkit

This commit is contained in:
Craig Raw
2020-08-02 18:03:24 +02:00
parent 2f8d40198e
commit 4068a6c541
9 changed files with 41 additions and 1 deletions
@@ -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