VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



[-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythm

by Xealot (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 11th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

[-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythms, Free to use!! VERY NEAT CODE

Rate [-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythm



' Encryption / Decryption BAS File
' By: Xealot [ Martin Engström ]
' Email: [email protected]
' ICQ: 100200781
' Special thanks to:
' Zipplet - For helping me with some bugs :)

'Usage:
'To decrypt type:
'answer$ = decrypt(text1.text, 3)
' It will save the info in answer$
' it will read of the data to decrypt from text1.text ( change it )
' it will use algorythm 3 ( change it ) - you can have from 1 to 31
'To encrypt type:
'answer$ = encrypt(text1.text, 3)
' It will save the information to answer$
' it will read of the data to encrypt from text1.text ( change it )
' it will use algorythm 3 ( change it ) - you can have from 1 to 31
'WARNING:
'The decryption must have same algorythm as the encryption had
'like if you encrypted with algorythm 3 then you must decrypt it
'with algorythm 3

'Tip:
'after a encrypt or decryp and you saved the data to answer$
'and you wish to have the data in a textbox like textbox2 then just
'simply type: text2.text = a$

'THIS CODE IS A FREEWARE AND YOU HAVE 100% RIGHT TO DISTRIBUTE IT

Public hh As String
Public Function encrypt(rf$, en$) As String
On Error GoTo err
If en$ < 0 Then
e = MsgBox("Invalid usage of Cypher" + vbCrLf + "You cannot have a algorythm lesser than 0", vbCritical + vbOKOnly, "Error")
ElseIf en$ > 31 Then
e = MsgBox("Invalid usage of Cypher" + vbCrLf + "You cannot have a algorythm greater than 31", vbCritical + vbOKOnly, "Error")
Else
op$ = ""
a$ = rf$
For n = 1 To Len(a$)
x$ = Mid$(a$, n, 1)
hh = Asc(x$)
If hh = "13" Then
op$ = op$ + vbCrLf
Else
hh = hh - Val(en$)
op$ = op$ + Chr$(hh)
End If
Next
encrypt = op$
End If
GoTo a
err:
e = MsgBox("Error occured in CYPHER" + vbCrLf + "Incompatible algorythm", vbCritical + vbOKOnly, "Error - CYPHER")
a:
End Function
Public Function decrypt(rf$, en$) As String
On Error GoTo err
If en$ < 0 Then
e = MsgBox("Invalid usage of Cypher" + vbCrLf + "You cannot have a algorythm lesser than 0", vbCritical + vbOKOnly, "Error")
ElseIf en$ > 31 Then
e = MsgBox("Invalid usage of Cypher" + vbCrLf + "You cannot have a algorythm greater than 31", vbCritical + vbOKOnly, "Error")
Else
op$ = ""
a$ = rf$
For n = 1 To Len(a$)
x$ = Mid$(a$, n, 1)
hh = Asc(x$)
If hh = "13" Then
op$ = op$ + vbCrLf
Else
hh = hh + Val(en$)
op$ = op$ + Chr$(hh)
End If
Next
decrypt = op$
End If
GoTo a
err:
e = MsgBox("Error occured in CYPHER" + vbCrLf + "Incompatible algorythm", vbCritical + vbOKOnly, "Error - CYPHER")
a:
End Function


Download this snippet    Add to My Saved Code

[-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythm Comments

No comments have been posted about [-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythm. Why not be the first to post a comment about [-CYPHER-] A very powerful Encrypt / Decrypt BAS file , Can handle from 1 to 31 different algorythm.

Post your comment

Subject:
Message:
0/1000 characters