home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / Crash_Encr196996252006.psc / CrashEncryption2 / Encrypt.frm < prev    next >
Text File  |  2006-02-05  |  6KB  |  145 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form Encrypt 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Crash Encryption (Processing...)"
  6.    ClientHeight    =   630
  7.    ClientLeft      =   45
  8.    ClientTop       =   360
  9.    ClientWidth     =   4230
  10.    ControlBox      =   0   'False
  11.    Icon            =   "Encrypt.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    NegotiateMenus  =   0   'False
  17.    ScaleHeight     =   630
  18.    ScaleWidth      =   4230
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin MSComctlLib.ProgressBar prog 
  21.       Height          =   255
  22.       Left            =   0
  23.       TabIndex        =   0
  24.       Top             =   360
  25.       Width           =   4215
  26.       _ExtentX        =   7435
  27.       _ExtentY        =   450
  28.       _Version        =   393216
  29.       Appearance      =   1
  30.    End
  31.    Begin VB.Label StatusLbl 
  32.       Alignment       =   2  'Center
  33.       BackStyle       =   0  'Transparent
  34.       Caption         =   "-----+++++-----"
  35.       BeginProperty Font 
  36.          Name            =   "MS Sans Serif"
  37.          Size            =   9.75
  38.          Charset         =   0
  39.          Weight          =   700
  40.          Underline       =   0   'False
  41.          Italic          =   0   'False
  42.          Strikethrough   =   0   'False
  43.       EndProperty
  44.       ForeColor       =   &H00FF0000&
  45.       Height          =   375
  46.       Left            =   0
  47.       TabIndex        =   1
  48.       Top             =   0
  49.       Width           =   4215
  50.    End
  51. End
  52. Attribute VB_Name = "Encrypt"
  53. Attribute VB_GlobalNameSpace = False
  54. Attribute VB_Creatable = False
  55. Attribute VB_PredeclaredId = True
  56. Attribute VB_Exposed = False
  57. '|||||||||||||||||||||||||||||||||||Disclaimer|||||||||||||||||||||||||||||||||||||'
  58. ' This code is written by Matthew Kernes. It is not intended for commercial use.   '
  59. ' It has no warranty nor is Matthew Kernes responsible for any damage it does to   '
  60. ' any computer it runs on. Any changes made to this software after the day October '
  61. ' 24th, 2005 by anyone other then Matthew Kernes is liabile for the changes and    '
  62. ' Matthew Kernes is not responsible for those changes or the problems they may     '
  63. ' cause.                                                                           '
  64. '||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'
  65.  
  66. ' I wrote this code because I wanted to see if I could make an unhackable encryption.
  67. ' I know there is no such thing as "unhackable" encryption. But I'd like to see how fast
  68. ' someone can break the code. Originally, I created a program that uses the Ceaser Cypher,
  69. ' but I didn't know it at the time. I was pretty new to encryption and I feel I still am.
  70. ' But I lay the challenge out now to anyone who might want it. Can you break this encryption?
  71.  
  72. ' I wrote the software with 2 ideas in mind.
  73. '    - How many varaibles does it take to make it so you can't solve for x?
  74. '    - How do you make it so the user cannot control the key or password?
  75.  
  76. ' With this in mind, I set out to make what is now "Crash Encryption".
  77. ' I dubbed it "Crash Encryption" because this program is somewhat a resource hog,
  78. ' as well, my nick-name is "Crash".
  79.  
  80. ' If you like what you see and have comments or questions, please feel free
  81. ' to email me at compiano@socal.rr.com. Voting is not necessary on my code.
  82.  
  83. ' Thanks for the view,
  84. '                   Matthew Kernes (Crash)
  85.  
  86. Public UseFolderPath  As String
  87. Option Explicit
  88.  
  89. Public Function Encrypt(OpenFile As String, SaveFile As String, FileTitle As String, KeyFile As String, complex As Integer)
  90. Me.Show ' Tah Dah! Here I am.
  91. StartFrm.Hide ' Hide the prepping form.
  92.  
  93. encryptFile OpenFile, SaveFile, KeyFile, FileTitle, complex, prog, StatusLbl
  94.  
  95. Me.Hide
  96. MsgBox "Encryption complete." ' What good program doesn't have some kind of good news to tell you after it just slaved for you?
  97. StartFrm.Show ' OK... Back to the start.
  98. End Function
  99.  
  100.  
  101. Public Function Decrypt(EncFile As String, DecFile As String)
  102. Dim FullFileTitle As String
  103.  
  104.     Me.Show ' Tah Dah! Here I am, again...
  105.  
  106.     FullFileTitle = decryptFile(EncFile, DecFile, App.Path & "\temp.file", prog, StatusLbl)
  107.     
  108. UseFolders:
  109.  
  110.     UseFolderPath = "" ' Blah blah blah.
  111.     Folders.Show , Me ' blah blah blah... again.
  112.     Folders.FlNm = FullFileTitle ' OK! We should tell them what the file is called.
  113.     
  114.     Do While UseFolderPath = "" ' Waiting for Christmas.
  115.         DoEvents
  116.     Loop
  117.     
  118.     If UseFolderPath = "Cancel" Then
  119.         If MsgBox("Are you sure you want to cancel?" & vbCrLf & vbCrLf & "If you cancel now, your decryption will not be saved." & vbCrLf, vbYesNo, "Confirm Cancel") = vbNo Then
  120.             GoTo UseFolders
  121.           Else
  122.             Kill App.Path & "\temp.file"
  123.             MsgBox "Decryption Canceled"
  124.             Me.Hide
  125.             StartFrm.Show ' It'd be nice to let them back to the begining.
  126.             Exit Function
  127.         End If
  128.     End If
  129.             
  130.     
  131.     'Create/use the directory. Copy the new file over. Kill the temp file.
  132.     FileCopy App.Path & "\temp.file", UseFolderPath & "\" & FullFileTitle
  133.     Kill App.Path & "\temp.file"
  134.     
  135.  
  136. Me.Hide
  137.  
  138. MsgBox "Decryption complete." ' See?
  139.  
  140. StartFrm.Show ' It'd be nice to let them back to the begining.
  141.  
  142. End Function
  143.  
  144.  
  145.