VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A high level encryption algorithm! the bigger the key ppl, the more secure your data will be!

by !Scott! (1 Submission)
Category: Encryption
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Fri 14th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

A high level encryption algorithm! the bigger the key ppl, the more secure your data will be!

API Declarations


'Text2 = Crypt(Text1, "secret_key_goes_here")
'To decrypt, do it exactly the same, but use the encrypted data as the Input string.

Rate A high level encryption algorithm! the bigger the key ppl, the more secure your data will be!



        Dim Sbox(0 To 255) As Long
        Dim Sbox2(0 To 255) As Long
        Dim j As Long, i As Long, t As Double
        Dim K As Long, temp As Long, Outp As String

                For i = 0 To 255
                Sbox(i) = i
                Next i

                 j = 1
                For i = 0 To 255
                    If j > Len(Key) Then j = 1
                    Sbox2(i) = Asc(Mid(Key, j, 1))
                    j = j + 1
                Next i

                 j = 0
                 For i = 0 To 255
                    j = (j + Sbox(i) + Sbox2(i)) Mod 256
                    temp = Sbox(i)
                    Sbox(i) = Sbox(j)
                    Sbox(j) = temp
                Next i

                 i = 0
                 j = 0
                For X = 1 To Len(inp)
                         i = (i + 1) Mod 256
                         j = (j + Sbox(i)) Mod 256
                         temp = Sbox(i)
                        Sbox(i) = Sbox(j)
                        Sbox(j) = temp
                        t = (Sbox(i) + Sbox(j)) Mod 256
                        K = Sbox(t)
                        Outp = Outp + Chr(Asc(Mid(inp, X, 1)) Xor K)
                Next X
                Crypt = Outp
        End Function


Download this snippet    Add to My Saved Code

A high level encryption algorithm! the bigger the key ppl, the more secure your data will be! Comments

No comments have been posted about A high level encryption algorithm! the bigger the key ppl, the more secure your data will be!. Why not be the first to post a comment about A high level encryption algorithm! the bigger the key ppl, the more secure your data will be!.

Post your comment

Subject:
Message:
0/1000 characters