• Tidak ada hasil yang ditemukan

Implementasi Perbedaan Algoritma Blim-Blum-Shub Dengan Algoritma Quadratic Linear Congruential Generator Pada Aplikasi Password Generator

N/A
N/A
Protected

Academic year: 2017

Membagikan "Implementasi Perbedaan Algoritma Blim-Blum-Shub Dengan Algoritma Quadratic Linear Congruential Generator Pada Aplikasi Password Generator"

Copied!
11
0
0

Teks penuh

(1)

LISTING PROGRAM

1. MainForm.cs

using System;

using System.Collections.Generic; using System.Drawing;

using System.Windows.Forms;

namespace generate_password {

/// <summary>

/// Description of MainForm. /// </summary>

public partial class MainForm : Form {

public MainForm() {

//

// The InitializeComponent() call is required for Windows Forms designer support. //

InitializeComponent();

//

// TODO: Add constructor code after the InitializeComponent() call. //

}

void BBSToolStripMenuItemClick(object sender, EventArgs e) {

bbs f = new bbs(); this.Hide(); f.Show(); }

void QLGCToolStripMenuItemClick(object sender, EventArgs e) {

qlcg f = new qlcg(); this.Hide();

f.Show(); }

void AboutToolStripMenuItemClick(object sender, EventArgs e) {

about f = new about(); this.Hide();

f.Show(); }

(2)

help f = new help(); this.Hide();

f.Show(); }

} }

2. BBS.cs usingSystem;

usingSystem.Drawing;

usingSystem.Windows.Forms;

usingSystem.Diagnostics;

namespacegenerate_password

{

///<summary>

///Description of bbs. ///</summary>

publicpartialclassbbs : Form {

Stopwatch watch =newStopwatch(); intp,q,n,s;

Random r =newRandom(); publicbbs()

{ //

// The InitializeComponent() call is required for Windows Forms designer support. //

InitializeComponent();

//

//TODO: Add constructor code after the InitializeComponent() call. //

}

publicboolIsPrime(intnum) {

bool_isPrime =true;

if(num%2==0)returnfalse; if(num%4!=3)returnfalse;

for(inti =3;i<= Math.Sqrt(num);i = i+2) {

if(num%i ==0) {

_isPrime =false; break;

} }

(3)

}

publicintGCD(inta,intb) {

intRemainder; while(b!=0) {

Remainder = a%b; a = b;

b = Remainder; }

returna; }

voidButton4Click(objectsender,EventArgs e) {

p = r.Next(3,10000);

while(IsPrime(p)==false) {

p = r.Next(3,10000); }

q = r.Next(3,10000);

while(IsPrime(q)==false) {

q = r.Next(3,10000); }

n = p*q;

textBox1.Text = p.ToString(); textBox2.Text = q.ToString(); textBox3.Text = n.ToString(); }

voidButton3Click(objectsender,EventArgs e) {

s = r.Next(2,n-1); while(GCD(n,s)!=1) {

s = r.Next(2,n-1); }

textBox4.Text = s.ToString(); }

voidBbsLoad(objectsender,EventArgs e) {

label5.Visible =false; label5.Text =null; }

(4)

MainForm f =newMainForm(); this.Hide();

f.Show(); }

voidButton2Click(objectsender,EventArgs e) {

p =0; q =0; n =0; s =0;

textBox1.Text =null; textBox2.Text =null; textBox3.Text =null; textBox4.Text =null; label5.Text =null; textBox6.Text =null; label5.Visible =false; }

voidButton1Click(objectsender,EventArgs e) {

label5.Text =null; watch.Restart(); doublex = s;

x =(Math.Pow(x,2))%n; inthasil;

int[]lastbin =newint[4]; while(label5.Text.Length <11) {

for(inti =0;i<4;i++) {

x =(Math.Pow(x,2))%n; if(x%2==0)

lastbin[i]=0; else

lastbin[i]=1; }

hasil =8*lastbin[0]+4*lastbin[1]+2*lastbin[2]+1*lastbin[3]; label5.Text+= hasil.ToString();

}

if(label5.Text.Length>10)

label5.Text = label5.Text.Substring(0,10); label5.Visible =true;

watch.Stop(); textBox6.Text =

Math.Round(Convert.ToDecimal(watch.Elapsed.TotalMilliseconds),4).ToString(); }

(5)

3. QLCG.cs

usingSystem;

usingSystem.Drawing;

usingSystem.Windows.Forms;

usingSystem.Diagnostics;

namespacegenerate_password

{

///<summary>

///Description of qlcg. ///</summary>

publicpartialclassqlcg : Form {

Stopwatch watch =newStopwatch(); inta,b,c,m,x0;

publicqlcg() {

//

// The InitializeComponent() call is required for Windows Forms designer support. //

InitializeComponent();

//

//TODO: Add constructor code after the InitializeComponent() call. //

}

voidButton2Click(objectsender,EventArgs e) {

a =0; b =0; c =0; m =0; x0 =0;

textBox1.Text =null; textBox2.Text =null; textBox3.Text =null; textBox4.Text =null; textBox5.Text =null; label5.Text =null; textBox6.Text =null; label5.Visible =false; }

voidButton5Click(objectsender,EventArgs e) {

MainForm f =newMainForm(); this.Hide();

(6)

}

voidQlcgLoad(objectsender,EventArgs e) {

label5.Visible =false; label5.Text =null; }

voidButton1Click(objectsender,EventArgs e) {

label5.Text =null; watch.Restart();

a = Convert.ToInt32(textBox1.Text); b = Convert.ToInt32(textBox2.Text); c = Convert.ToInt32(textBox3.Text); m = Convert.ToInt32(textBox4.Text); x0 = Convert.ToInt32(textBox5.Text); if(a>= m||b>= m||c>= m||x0>= m) {

MessageBox.Show("generate ulang !!!"); }

else {

doublex = x0; inthasil;

int[]lastbin =newint[4]; while(label5.Text.Length <11) {

for(inti =0;i<4;i++) {

x =((a*x*x)+(b*x)+c)%m; if(x%2==0)

lastbin[i]=0; else

lastbin[i]=1; }

hasil =8*lastbin[0]+4*lastbin[1]+2*lastbin[2]+1*lastbin[3]; label5.Text+= hasil.ToString();

}

if(label5.Text.Length>10)

label5.Text = label5.Text.Substring(0,10); label5.Visible =true;

}

watch.Stop(); textBox6.Text =

Math.Round(Convert.ToDecimal(watch.Elapsed.TotalMilliseconds),4).ToString();

(7)

4. About.cs

using System;

using System.Drawing;

using System.Windows.Forms;

namespace generate_password {

/// <summary>

/// Description of about. /// </summary>

public partial class about : Form {

public about() {

//

// The InitializeComponent() call is required for Windows Forms designer support. //

InitializeComponent();

//

// TODO: Add constructor code after the InitializeComponent() call. //

}

void HomeToolStripMenuItemClick(object sender, EventArgs e) {

MainForm f = new MainForm(); this.Hide();

f.Show(); }

void QLCGToolStripMenuItemClick(object sender, EventArgs e) {

qlcg f = new qlcg(); this.Hide();

f.Show(); }

void BBSToolStripMenuItemClick(object sender, EventArgs e) {

bbs f = new bbs(); this.Hide(); f.Show(); }

void HelpToolStripMenuItemClick(object sender, EventArgs e) {

(8)

f.Show(); }

} }

5. Help.cs

using System;

using System.Drawing;

using System.Windows.Forms;

namespace generate_password {

/// <summary>

/// Description of help. /// </summary>

public partial class help : Form {

public help() {

//

// The InitializeComponent() call is required for Windows Forms designer support. //

InitializeComponent();

//

// TODO: Add constructor code after the InitializeComponent() call. //

}

void HelpToolStripMenuItemClick(object sender, EventArgs e) {

about f = new about(); this.Hide();

f.Show(); }

void HomeToolStripMenuItemClick(object sender, EventArgs e) {

MainForm f = new MainForm(); this.Hide();

f.Show(); }

void BBSToolStripMenuItemClick(object sender, EventArgs e) {

(9)

void QLCGToolStripMenuItemClick(object sender, EventArgs e) {

qlcg f = new qlcg(); this.Hide();

f.Show(); }

void Label2Click(object sender, EventArgs e) {

}

void Label11Click(object sender, EventArgs e) {

}

void Label7Click(object sender, EventArgs e) {

}

void Label8Click(object sender, EventArgs e) {

}

void Label13Click(object sender, EventArgs e) {

} } }

6. Program.cs

using System;

using System.Windows.Forms;

namespace generate_password {

/// <summary>

/// Class with program entry point. /// </summary>

internal sealed class Program {

/// <summary>

(10)

[STAThread]

private static void Main(string[] args) {

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm());

(11)

B-1

PERSONAL DATA

Full Name Denny Dwi Daviki Lubis

Nick Name Denny

Place / Date of

Birth

Binjai/30 Juli 1992

Sex Male

Religion Islam

Address Jl. Anggrek No.35a

Kec. Binjai Utara

Kota Binjai

Prov. Sumatera Utrara

Mobile Phone 0831 9932 8905

E-mail nobodyx92@gmail.com

EDUCATION

Barchelor

Computer Science

Universitas Sumatera Utara

2014-2017

Diploma 3

Computer Engineering

Politeknik Negeri Medan

2010-2013

Higher Secondary Education SMA N 2 Binjai

2007-2010

Secondary Education SMP N 3 Binjai

2004-2007

Primary Education SD N 023903 Binjai

1997-2004

COMPUTER SKILL

Programming Java, C#

Referensi

Dokumen terkait

Tuliskan perkataan berimbuhan yang betul berdasarkan kata dasar dalam kurungan yang diberikan... Padankan frasa dengan kata hubung

Pada grafik briket yang memiliki durasi pembakaran terlama adalah briket dengan ukuran partikel 60 mesh dengan tekanan press sebesar 2 MPa.. Berdasarkan hasil uji

diawasi, Ooh kalau itu tidak pernah mas, soalnya saya kalau berobat di RSPAW Salatiga cuman minum obat aja P1 (87-135) Pengontrolan yang dilakukan oleh petugas atapun

p Persepsi Terhadap Informasi Kesehatan pada Facebook: Kasus pada Mahasiswa Sejarah Kebudayaan Islam Konsentrasi Ilmu Informasi dan Perpustakaan Fakultas Adab dan

Pada penelitian ini, peneliti akan melakukan uji keabsahan data dengan menggunakan teknik member cheking dan metode.

• Jika dalam sebuah program kita menggunakan nama class yang sama, maka import dua package tersebut dan gunakan nama class berserta maka import dua package tersebut, dan gunakan

International Union Against Tuberculosis and lung Disease (IULTD) dan WHO menyarankan untuk mengganti panduan obat tunggal dengan kombinasi dosis.. tetap yang

mikroba mempunyai kontribusi dalam produksi dan kesehatan tanaman terkait dengan: (1) mikroba berperan penting dalam dekomposisi bahan organik (Iimbah pertanian dan hewan), yang