Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?



This function encrypts strings. It takes the general form:

ENCRYPT(string, key, method) 


  • string specifies the string to be encrypted.
  • key is the value used to encrypt the string. Its use depends on method.
  • method is a value which indicates the encryption mechanism to.

The ENCRYPT and DECRYPT functions that are part of jBASE BASIC now support the following  cipher methods (Defined in JBC.h)

  • JBASE_CRYPT_GENERAL General-purpose encryption scheme
  • JBASE_CRYPT_AES algorithm (AES256)
  • JBASE_CRYPT_AES_BASE64 algorithm (AES256, BASE64 encoded)
  • JBASE_CRYPT_ROT13 Simple ROT13 algorithm. (Key not used)
  • JBASE_CRYPT_XOR11 XOR MOD11 algorithm. Uses the first character of a key as a seed value.
  • JBASE_CRYPT_RC2 RC2 algorithm
  • JBASE_CRYPT_DES DES algorithm
  • JBASE_CRYPT_3DES Three Key, Triple DES algorithm
  • JBASE_CRYPT_BLOWFISH Blowfish algorithm
  • JBASE_CRYPT_BASE64 (See below)

BASE64  is not really an encryption method, but more of an encoding. The reason  for this is that the output of an encryption often results in a binary  string. It allows binary data to be represented as a character string.  BASE64 operation is not required but is performed in addition to the  primary algorithm. e.g. JBASE_CRYPT_RC2_BASE64

ENCRYPT with this method is the same as a DECRYPT with method JBASE_CRYPT_RC2  followed by DECRYPT with method JBASE_CRYPT_BASE64.

DECRYPT  with this method is the same as a DECRYPT with method  JBASE_CRYPT_BASE64 followed by DECRYPT with method JBASE_CRYPT_RC2.

  • JBASE_CRYPT_RC2_BASE64 RC2 algorithm
  • JBASE_CRYPT_DES_BASE64 DES algorithm
  • JBASE_CRYPT_3DES_BASE64 Triple DES algorithm
  • JBASE_CRYPT_BLOWFISH _BASE64 Blowfish algorithm.

An example of use may be as follows:

0001     INCLUDE JBC.h
0003     cipher = JBASE_CRYPT_BLOWFISH_BASE64
0005     key = "Thunderbirds 2086"
0006     str = "This is the string to be encrypted"
0007     enc = ENCRYPT(str, key, cipher)
0009     CRT "Encrypted: " :enc
0011     CRT "Decrypted: ":DECRYPT(enc, key, cipher)

The above will display as output:

Encrypted: bjrngdlVNjSsY6iUVhn8pA9WD2cYo7HB8at0QhwvjvApc8Gih8PQ/A==
Decrypted: This is the string to be encrypted

See also: DECRYPT.

Go back to jBASE BASIC.

Was this article helpful?