viernes, 7 de septiembre de 2007

JP Key Generator



Es por lejos la aplicación más sencillita que hice, pero no por eso deja de ser útil. Genera strings aleatorios con el largo que le indicás. Incluye símbolos, mayúsculas, minúsculas y números. Ideal para los obsesionados con la seguridad de las contraseñas.

Descarga

Por cierto... es open source:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace cutomDevZuccarino
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
int largo = Convert.ToInt32(txtLargo.Text);

textBox1.Text = RandomString(largo);
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
}
}
private string RandomString(int size)
{
System.Threading.Thread.Sleep(5);
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch;
int ran;
for (int i = 0; i < size; i++)
{

ran = random.Next(32, 126);
ch = Convert.ToChar(ran);
ran = random.Next(0, 2);
builder.Append(ch);
}

return builder.ToString();
}

}
}