SlideShare uma empresa Scribd logo
Ketikkan Coding :
Imports Encryption.Crypto.Secret
Public Class Form1
'Reflects the index of the image
Private Enum Images
Encrypted = 0
Decrypted = 1
Folder_Open = 2
End Enum
#Region " Events"
#Region " Form Events"
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.btnEncrypt.Image = Me.ImageList1.Images(Images.Encrypted)
Me.btnDecrypt.Image = Me.ImageList1.Images(Images.Decrypted)
Me.btnOpenInput.Image = Me.ImageList1.Images(Images.Folder_Open)
Me.btnOpenOutput.Image = Me.ImageList1.Images(Images.Folder_Open)
End Sub
#End Region

'Form Events

#Region " Control Events"
Private Sub Open(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles btnOpenInput.Click
Dim btn As Button = DirectCast(sender, Button)
'The name of the TextBox to return the selected file path to is stored
' in the Tag property of the button.
Dim tb As TextBox = _
DirectCast(btn.Parent.Controls(btn.Tag.ToString()), TextBox)
Dim diag As New OpenFileDialog()
With diag
.CheckFileExists = True
.CheckPathExists = True
.Multiselect = False
.RestoreDirectory = True
.Title = "Please select an Input file"
.Filter = "All Files (*.*)|*.*"
.ShowDialog()
'Set the file path if one was selected
If .FileName.Trim() <> "" Then _
tb.Text = .FileName
End With
diag.Dispose()
End Sub

Private Sub Save(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnOpenOutput.Click
Dim btn As Button = DirectCast(sender, Button)
'The name of the TextBox to return the selected file path to is stored
' in the Tag property of the button.
Dim tb As TextBox = _
DirectCast(btn.Parent.Controls(btn.Tag.ToString()), TextBox)
Dim diag As New SaveFileDialog()
With diag
.AddExtension = True
.CheckFileExists = False
.CheckPathExists = True
.CreatePrompt = False
'Set the extension if there is an input file
If My.Computer.FileSystem.FileExists(Me.tbInput.Text.Trim()) = True Then
.DefaultExt = System.IO.Path.GetExtension(Me.tbInput.Text)
'Set the filter to whatever type of file was selected as an input file
.Filter = String.Concat(StrConv(.DefaultExt, VbStrConv.ProperCase), _
" Files (*.", .DefaultExt, ")|*.", .DefaultExt, _
"|All Files (*.*)|*.*")
Else
.Filter &= "All Files (*.*)|*.*"
End If
.OverwritePrompt = True
.RestoreDirectory = True
.Title = "Please enter an output file."
.ShowDialog()
If .FileName.Trim() <> "" Then _
tb.Text = .FileName
End With
diag.Dispose()
End Sub

Private Sub btnEncrypt_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnEncrypt.Click
'Get the reference to the button that was clicked
Dim clickedButton As Button = DirectCast(sender, Button)
'Call the EncryptDecrypt method and pass to it the Button that was clicked
EncryptDecrypt(clickedButton)
MessageBox.Show("Encryption complete!", "Encryption complete", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub

Private Sub btnDecrypt_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnDecrypt.Click
'Get the reference to the button that was clicked
Dim clickedButton As Button = DirectCast(sender, Button)
'Call the EncryptDecrypt method and pass to it the Button that was clicked
EncryptDecrypt(clickedButton)
MessageBox.Show("Decryption complete!", "Decryption complete", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub

Private Sub lblWikiLink_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles lblWikiLink.Click
System.Diagnostics.Process.Start(Me.lblWikiLink.Text)
End Sub

Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles
rbAes.CheckedChanged, rbTripleDes.CheckedChanged, rbRijndael.CheckedChanged,
rbRc2.CheckedChanged, rbDes.CheckedChanged
Dim enc As Encryption.Crypto.Secret._BaseEncryption = _
GetEncryptor()

tbSecretEncryptorDesc.Text = enc.Description
End Sub
#End Region

'Control Events

#End Region

'Events

#Region " Methods"
Private Sub EncryptDecrypt(ByVal clickedButton As Button)
'Create a new instance of the _BaseEncryption class,
' and get the appropriate encryptor class
Dim enc As Encryption.Crypto.Secret._BaseEncryption = _
GetEncryptor()
'Encrypt or Decrypt the selected file.
' (This will call the corresponding method in the actual class)
If clickedButton.Text = "Encrypt" Then
enc.Encrypt(Me.tbInput.Text.Trim(), Me.tbOutput.Text.Trim())
ElseIf clickedButton.Text = "Decrypt" Then
enc.Decrypt(Me.tbInput.Text.Trim(), Me.tbOutput.Text.Trim())
End If
End Sub

Private Function GetEncryptor() As _BaseEncryption
Dim enc As Encryption.Crypto.Secret._BaseEncryption = Nothing
Dim wikiLink As String = String.Empty
'Set the _BaseEncryption class to the class corresponding to the RadioButton
' that was clicked
Select Case True
Case Me.rbAes.Checked
enc = AES.Create()
wikiLink = "http://en.wikipedia.org/wiki/Advanced_Encryption_Standard"
Case Me.rbDes.Checked
enc = DES.Create()
wikiLink = "http://en.wikipedia.org/wiki/Data_Encryption_Standard"
Case Me.rbRc2.Checked
enc = Rc2.Create()
wikiLink = "http://en.wikipedia.org/wiki/RC2"
Case Me.rbRijndael.Checked
enc = Rijndael.Create()
wikiLink = "http://en.wikipedia.org/wiki/Rijndael_encryption_algorithm"
Case Me.rbTripleDes.Checked
enc = TripleDes.Create()
wikiLink = "http://en.wikipedia.org/wiki/Triple_DES"
End Select
Me.lblWikiLink.Text = wikiLink
Return enc
End Function
#End Region
End Class

'Methods

Mais conteúdo relacionado

Mais procurados

Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5sotlsoc
 
Código Opção Substituir
Código Opção SubstituirCódigo Opção Substituir
Código Opção Substituircymbron
 
Código Editor Net
Código Editor NetCódigo Editor Net
Código Editor Netcymbron
 
Creating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsCreating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsSencha
 
Java eventhandling
Java eventhandlingJava eventhandling
Java eventhandlingArati Gadgil
 
Código Acerca Editor_Net
Código Acerca Editor_NetCódigo Acerca Editor_Net
Código Acerca Editor_Netcymbron
 
JAVA GUI PART III
JAVA GUI PART IIIJAVA GUI PART III
JAVA GUI PART IIIOXUS 20
 
Lesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFLesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFQuang Nguyễn Bá
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativoLeo Chavez Martinez
 
Ordenar vector
Ordenar vectorOrdenar vector
Ordenar vectorecasteloc
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativoLeo Chavez Martinez
 

Mais procurados (18)

Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
 
Trabajo de case
Trabajo de caseTrabajo de case
Trabajo de case
 
Código Opção Substituir
Código Opção SubstituirCódigo Opção Substituir
Código Opção Substituir
 
Código Editor Net
Código Editor NetCódigo Editor Net
Código Editor Net
 
Creating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsCreating Ext GWT Extensions and Components
Creating Ext GWT Extensions and Components
 
Event handling in Java(part 2)
Event handling in Java(part 2)Event handling in Java(part 2)
Event handling in Java(part 2)
 
Java eventhandling
Java eventhandlingJava eventhandling
Java eventhandling
 
Trabajo de case
Trabajo de caseTrabajo de case
Trabajo de case
 
Código Acerca Editor_Net
Código Acerca Editor_NetCódigo Acerca Editor_Net
Código Acerca Editor_Net
 
Stop watch and array
Stop watch and arrayStop watch and array
Stop watch and array
 
Work flow
Work flowWork flow
Work flow
 
JAVA GUI PART III
JAVA GUI PART IIIJAVA GUI PART III
JAVA GUI PART III
 
Event handling in Java(part 1)
Event handling in Java(part 1)Event handling in Java(part 1)
Event handling in Java(part 1)
 
Lesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFLesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPF
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativo
 
Ordenar vector
Ordenar vectorOrdenar vector
Ordenar vector
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativo
 

Semelhante a Metode

Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdfapnashop1
 
Elementos del lenguaje
Elementos del lenguajeElementos del lenguaje
Elementos del lenguajeguest6473b8
 
1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docxcorbing9ttj
 
1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docxcorbing9ttj
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01mafv1976
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventasDAYANA RETO
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITYDOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITYGOKUL SREE
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informaticamiguel camelo
 
C++ Windows Forms L10 - Instantiate
C++ Windows Forms L10 - InstantiateC++ Windows Forms L10 - Instantiate
C++ Windows Forms L10 - InstantiateMohammad Shaker
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVASrajan Shukla
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativoLeo Chavez Martinez
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduinozadkiel_123
 

Semelhante a Metode (20)

Docimp
DocimpDocimp
Docimp
 
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 
Elementos del lenguaje
Elementos del lenguajeElementos del lenguaje
Elementos del lenguaje
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx
 
1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
 
Colegio municipal
Colegio municipalColegio municipal
Colegio municipal
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITYDOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informatica
 
Ete programs
Ete programsEte programs
Ete programs
 
Calculator code
Calculator codeCalculator code
Calculator code
 
C++ Windows Forms L10 - Instantiate
C++ Windows Forms L10 - InstantiateC++ Windows Forms L10 - Instantiate
C++ Windows Forms L10 - Instantiate
 
Inventory management
Inventory managementInventory management
Inventory management
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
 
Código fuente del software educativo
Código fuente del software educativoCódigo fuente del software educativo
Código fuente del software educativo
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduino
 

Último

The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPragya - UEM Kolkata Quiz Club
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxShibin Azad
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 

Último (20)

Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdfPost Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 

Metode

  • 1. Ketikkan Coding : Imports Encryption.Crypto.Secret Public Class Form1 'Reflects the index of the image Private Enum Images Encrypted = 0 Decrypted = 1 Folder_Open = 2 End Enum
  • 2. #Region " Events" #Region " Form Events" Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Me.btnEncrypt.Image = Me.ImageList1.Images(Images.Encrypted) Me.btnDecrypt.Image = Me.ImageList1.Images(Images.Decrypted) Me.btnOpenInput.Image = Me.ImageList1.Images(Images.Folder_Open) Me.btnOpenOutput.Image = Me.ImageList1.Images(Images.Folder_Open) End Sub #End Region 'Form Events #Region " Control Events" Private Sub Open(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles btnOpenInput.Click Dim btn As Button = DirectCast(sender, Button) 'The name of the TextBox to return the selected file path to is stored ' in the Tag property of the button. Dim tb As TextBox = _ DirectCast(btn.Parent.Controls(btn.Tag.ToString()), TextBox) Dim diag As New OpenFileDialog() With diag .CheckFileExists = True .CheckPathExists = True .Multiselect = False .RestoreDirectory = True .Title = "Please select an Input file" .Filter = "All Files (*.*)|*.*" .ShowDialog() 'Set the file path if one was selected If .FileName.Trim() <> "" Then _ tb.Text = .FileName End With diag.Dispose() End Sub Private Sub Save(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnOpenOutput.Click Dim btn As Button = DirectCast(sender, Button) 'The name of the TextBox to return the selected file path to is stored ' in the Tag property of the button.
  • 3. Dim tb As TextBox = _ DirectCast(btn.Parent.Controls(btn.Tag.ToString()), TextBox) Dim diag As New SaveFileDialog() With diag .AddExtension = True .CheckFileExists = False .CheckPathExists = True .CreatePrompt = False 'Set the extension if there is an input file If My.Computer.FileSystem.FileExists(Me.tbInput.Text.Trim()) = True Then .DefaultExt = System.IO.Path.GetExtension(Me.tbInput.Text) 'Set the filter to whatever type of file was selected as an input file .Filter = String.Concat(StrConv(.DefaultExt, VbStrConv.ProperCase), _ " Files (*.", .DefaultExt, ")|*.", .DefaultExt, _ "|All Files (*.*)|*.*") Else .Filter &= "All Files (*.*)|*.*" End If .OverwritePrompt = True .RestoreDirectory = True .Title = "Please enter an output file." .ShowDialog() If .FileName.Trim() <> "" Then _ tb.Text = .FileName End With diag.Dispose() End Sub Private Sub btnEncrypt_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnEncrypt.Click 'Get the reference to the button that was clicked Dim clickedButton As Button = DirectCast(sender, Button) 'Call the EncryptDecrypt method and pass to it the Button that was clicked EncryptDecrypt(clickedButton) MessageBox.Show("Encryption complete!", "Encryption complete", _ MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub Private Sub btnDecrypt_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnDecrypt.Click 'Get the reference to the button that was clicked
  • 4. Dim clickedButton As Button = DirectCast(sender, Button) 'Call the EncryptDecrypt method and pass to it the Button that was clicked EncryptDecrypt(clickedButton) MessageBox.Show("Decryption complete!", "Decryption complete", _ MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub Private Sub lblWikiLink_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles lblWikiLink.Click System.Diagnostics.Process.Start(Me.lblWikiLink.Text) End Sub Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles rbAes.CheckedChanged, rbTripleDes.CheckedChanged, rbRijndael.CheckedChanged, rbRc2.CheckedChanged, rbDes.CheckedChanged Dim enc As Encryption.Crypto.Secret._BaseEncryption = _ GetEncryptor() tbSecretEncryptorDesc.Text = enc.Description End Sub #End Region 'Control Events #End Region 'Events #Region " Methods" Private Sub EncryptDecrypt(ByVal clickedButton As Button) 'Create a new instance of the _BaseEncryption class, ' and get the appropriate encryptor class Dim enc As Encryption.Crypto.Secret._BaseEncryption = _ GetEncryptor() 'Encrypt or Decrypt the selected file. ' (This will call the corresponding method in the actual class) If clickedButton.Text = "Encrypt" Then enc.Encrypt(Me.tbInput.Text.Trim(), Me.tbOutput.Text.Trim()) ElseIf clickedButton.Text = "Decrypt" Then enc.Decrypt(Me.tbInput.Text.Trim(), Me.tbOutput.Text.Trim()) End If
  • 5. End Sub Private Function GetEncryptor() As _BaseEncryption Dim enc As Encryption.Crypto.Secret._BaseEncryption = Nothing Dim wikiLink As String = String.Empty 'Set the _BaseEncryption class to the class corresponding to the RadioButton ' that was clicked Select Case True Case Me.rbAes.Checked enc = AES.Create() wikiLink = "http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" Case Me.rbDes.Checked enc = DES.Create() wikiLink = "http://en.wikipedia.org/wiki/Data_Encryption_Standard" Case Me.rbRc2.Checked enc = Rc2.Create() wikiLink = "http://en.wikipedia.org/wiki/RC2" Case Me.rbRijndael.Checked enc = Rijndael.Create() wikiLink = "http://en.wikipedia.org/wiki/Rijndael_encryption_algorithm" Case Me.rbTripleDes.Checked enc = TripleDes.Create() wikiLink = "http://en.wikipedia.org/wiki/Triple_DES" End Select Me.lblWikiLink.Text = wikiLink Return enc End Function #End Region End Class 'Methods