Results 1 to 40 of 59

Thread: VB - 31 Bit Encryption function

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    VB - 31 Bit Encryption function

    You can Encrypt AND Decrypt using the same function (with the same password of course)
    VB Code:
    1. Public Function RndCrypt(ByVal Str As String, ByVal Password As String) As String
    2.     '
    3.     '  Made by Michael Ciurescu (CVMichael from vbforums.com)
    4.     '  Original thread: [url]http://www.vbforums.com/showthread.php?t=231798[/url]
    5.     '
    6.     Dim SK As Long, K As Long
    7.    
    8.     ' init randomizer for password
    9.     Rnd -1
    10.     Randomize Len(Password)
    11.     ' (((K Mod 256) Xor Asc(Mid$(Password, K, 1))) Xor Fix(256 * Rnd)) -> makes sure that a
    12.     ' password like "pass12" does NOT give the same result as the password "sspa12" or "12pass"
    13.     ' or "1pass2" etc. (or any combination of the same letters)
    14.    
    15.     For K = 1 To Len(Password)
    16.         SK = SK + (((K Mod 256) Xor Asc(Mid$(Password, K, 1))) Xor Fix(256 * Rnd))
    17.     Next K
    18.    
    19.     ' init randomizer for encryption/decryption
    20.     Rnd -1
    21.     Randomize SK
    22.    
    23.     ' encrypt/decrypt every character using the randomizer
    24.     For K = 1 To Len(Str)
    25.         Mid$(Str, K, 1) = Chr(Fix(256 * Rnd) Xor Asc(Mid$(Str, K, 1)))
    26.     Next K
    27.    
    28.     RndCrypt = Str
    29. End Function
    Last edited by CVMichael; Nov 30th, 2005 at 11:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width