/// <summary> /// Code which is actually run on the generation thread. /// </summary> private void GenerationThreadProcess() { Bip38Intermediate intermediate = null; if (GenChoice == GenChoices.Encrypted) { intermediate = new Bip38Intermediate(UserText, Bip38Intermediate.Interpretation.Passphrase); } int detcount = 1; while (RemainingToGenerate > 0 && StopRequested == false) { KeyCollectionItem newitem = null; switch (GenChoice) { case GenChoices.Minikey: MiniKeyPair mkp = MiniKeyPair.CreateRandom(ExtraEntropy.GetEntropy()); string s = mkp.AddressBase58; // read the property to entice it to compute everything newitem = new KeyCollectionItem(mkp); break; case GenChoices.WIF: KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); s = kp.AddressBase58; newitem = new KeyCollectionItem(kp); break; case GenChoices.Deterministic: kp = KeyPair.CreateFromString(UserText + detcount); detcount++; s = kp.AddressBase58; newitem = new KeyCollectionItem(kp); break; case GenChoices.Encrypted: Bip38KeyPair ekp = new Bip38KeyPair(intermediate); newitem = new KeyCollectionItem(ekp); break; case GenChoices.TwoFactor: ekp = new Bip38KeyPair(intermediatesForGeneration[intermediateIdx++]); if (intermediateIdx >= intermediatesForGeneration.Length) { intermediateIdx = 0; } newitem = new KeyCollectionItem(ekp); break; } lock (GeneratedItems) { GeneratedItems.Add(newitem); RemainingToGenerate--; } } GeneratingEnded = true; }
/// <summary> /// Code which is actually run on the generation thread. /// </summary> private void GenerationThreadProcess() { Bip38Intermediate intermediate = null; if (GenChoice == GenChoices.Encrypted) { try { intermediate = new Bip38Intermediate(txtTextInput.Text, Bip38Intermediate.Interpretation.IntermediateCode); } catch { } // sink exceptions - just means it's not an intermediate code if (intermediate == null) { intermediate = new Bip38Intermediate(UserText, Bip38Intermediate.Interpretation.Passphrase); } } int detcount = 1; while (RemainingToGenerate > 0 && StopRequested == false) { KeyCollectionItem newitem = null; switch (GenChoice) { case GenChoices.Minikey: MiniKeyPair mkp = MiniKeyPair.CreateRandom(ExtraEntropy.GetEntropy()); string s = mkp.AddressBase58; // read the property to entice it to compute everything newitem = new KeyCollectionItem(mkp); break; case GenChoices.WIF: KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); s = kp.AddressBase58; newitem = new KeyCollectionItem(kp); break; case GenChoices.Deterministic: kp = KeyPair.CreateFromString(UserText + detcount); detcount++; s = kp.AddressBase58; newitem = new KeyCollectionItem(kp); break; case GenChoices.Encrypted: Bip38KeyPair ekp = new Bip38KeyPair(intermediate); newitem = new KeyCollectionItem(ekp); break; } lock (GeneratedItems) { GeneratedItems.Add(newitem); RemainingToGenerate--; } } GeneratingEnded = true; }