Ejemplo n.º 1
0
    public int[] testHexConversion()
    {
        int[] passed = new int[2];
        passed[1] = 2;

        string hex          = "3720B091810D8127C55630F55DD2275C05";
        string hardSentence = "ugly call give address amount venture misery dose quick spoil weekend inspire";
        string sentence     = bpc.getSentenceFromHex(hex);

        if (hex == bpc.getHexFromSentence(sentence))
        {
            passed[0] += 1;
        }
        else
        {
            Debug.Log("BIP39 test converting hex to BIP39 sentence and back failed");
        }
        if (hardSentence == sentence)
        {
            passed[0] += 1;
        }
        else
        {
            Debug.Log("BIP39 test converting sentence to hex and back failed");
        }

        return(passed);
    }
Ejemplo n.º 2
0
    public void SetRandomBIP39Seed()
    {
        BIP39Converter bpc = new BIP39Converter();

        InteractablePathManager.SetRandomSeed();

        TMP_InputField seedInputField = GetComponentInChildren <TMP_InputField>();

        seedInputField.text = bpc.getSentenceFromHex(InteractablePathManager.SeedString);
    }
Ejemplo n.º 3
0
    public void SwitchSeedFormat()
    {
        TMP_InputField seedInputField = GetComponentInChildren <TMP_InputField>();

        if (isBip)
        {
            seedInputField.text = InteractablePathManager.SeedString;
            isBip = false;
        }
        else
        {
            BIP39Converter bpc = new BIP39Converter();
            seedInputField.text = bpc.getSentenceFromHex(InteractablePathManager.SeedString);
            isBip = true;
        }
    }
Ejemplo n.º 4
0
    /// <summary> Toggles On the EndGameUI </summary>
    static public void ToggleOn()
    {
        if (Instance.gameObject.activeSelf)
        {
            return;
        }

        Instance.gameObject.SetActive(true);
        var            textList  = Instance.GetComponentsInChildren <TMPro.TextMeshProUGUI>();
        SeedConverter  converter = new SeedConverter();
        BIP39Converter bpc       = new BIP39Converter();

        //textList[0].text = converter.DecodeSeed();

/*        for (int i = 0; i < textList.Length; i++)
 *      {
 *          Debug.Log("Text data #" + i + ": " + textList[i].text);
 *      }
 */
        if (InteractableConfig.SeedHexLength % 2 == 1)
        {
            string alteredSeedText = converter.DecodeSeed();
            string sentence        = bpc.getSentenceFromHex(alteredSeedText);

            char[] array = alteredSeedText.ToCharArray();
            array[array.Length - 2] = array[array.Length - 1];
            alteredSeedText         = new string(array);
            if (alteredSeedText.Length > 1)
            {
                alteredSeedText = alteredSeedText.Substring(0, (alteredSeedText.Length - 1));
            }

            hexSeed          = alteredSeedText;
            bipSeed          = sentence;
            textList[0].text = sentence;
        }
        else
        {
            //textList[0].text = converter.DecodeSeed();
            string hex      = converter.DecodeSeed();
            string sentence = bpc.getSentenceFromHex(hex);
            hexSeed          = hex;
            bipSeed          = sentence;
            textList[0].text = sentence;
        }

        //Debug.Log("Hex: " + hexSeed);
        //Debug.Log("Bip: " + bipSeed);

        if (GameManager.Mode == GameMode.Rehearsal)
        {
            //textList[2].text = "Key Learned!";
            textList[3].text = "Practice Again";
        }
        else
        {
            //textList[2].text = "Key Recovered!";
            textList[3].text = "Try Again";
        }

        for (int i = 0; i < textList.Length; i++)
        {
            //Debug.Log("Text data #" + i + ": " + textList[i].text);
        }

        setupCharacterMode();
    }
Ejemplo n.º 5
0
 public void SetRandomBIP39Seed()
 {
     InteractablePathManager.SetRandomSeed();
     seedInputField.text = bpc.getSentenceFromHex(InteractablePathManager.SeedString);
 }