Mintoris Forum

Author Topic: RC4 Encryption  (Read 2356 times)


  • Sr. Member
  • ****
  • Posts: 126
  • If life throws a planet at you, pull your ripcord‼
RC4 Encryption
« on: Mar 15, 2011, 01:04 PM »
I found a reference to a simple encryption technology in the wiki, and decided to code it in. It's not very fast. It takes 2.2 seconds on a Droid X to encrypt 1024 bytes of data, but for passwords and credit card numbers, its perfect. And its real encryption. Its the same algorithm used in wep to make wifi encrypted. And the file and subs are really small.

There are two functions inside. wsRC4CreateKey$ and wsRC4Encrypt$.  wsRC4CreateKey$ is optional and simply adds an extra layer of security by extending a small password to a key that is at least 40 bytes.  wsRC4Encrypt$ returns an encrypted or decrypted string of data based on the text that is sent to it and the password. Note that you use wsRC4Encrypt$ to encrypt AND decrypt data. Just be sure to use the exact same password key that you used to encrypt the text to decrypt it. There is a link to the wiki reference inside the attached file.

Please forgive me; I'm in a rush at the moment and don't have time to elaborate further.


Here is a test program.

include "wsRC4.bas"
pw$ = "your password here"
print "Passwd: "; pw$
key$ = wsRC4CreateKey$(pw$)
print "Key: "; key$
text$ = "The quick brown fox jumps over the lazy-ass dog."
print "Text: "; text$
enc$ = wsRC4Encrypt$(text$, key$)
print "Encrypted: "; enc$
dec$ = wsRC4Encrypt$(enc$, key$)
print "Decrypted: "; dec$

« Last Edit: Mar 15, 2011, 08:30 PM by Jesse »


  • Full Member
  • ***
  • Posts: 21
Re: RC4 Encryption
« Reply #1 on: Jun 25, 2014, 04:20 AM »
Awesome Jesse… I've been on an encryption fix lately and I'll be checking this out more closely.