De interface van VDS Renaissance is in meerdere talen beschikbaar. De officiële documentatie wordt in het Engels onderhouden om één consistente en altijd actuele referentie te garanderen.
@ENCRYPT
Syntax
@ENCRYPT(<string> {,<encryption type>})
@ENCRYPT(<string>, AES | AESDEC | BF | BFDEC, <key>)
Description
This function returns the <string> value encrypted using <encryption type>.
Valid values for <encryption type> are:
| <number> | The string is reversibly encrypted using the supplied number. The encrypted string can be decrypted by repeating the function using the same number. |
| MD5 | The function returns an MD5 hash of the string, as a hexadecimal string. |
| CRC | [VDS6] The function returns a 32-bit CRC hash of the string, as a hexadecimal string. |
| AES | [VDS7] Encrypts the string with AES-256 using the pass phrase given as the third parameter, and returns the result as base64. |
| AESDEC | [VDS7] Decrypts a base64 string previously produced with AES, using the same key, and returns the plain text. |
| BF | [VDS7] Encrypts the string with Blowfish using the third-parameter key, and returns base64. |
| BFDEC | [VDS7] Decrypts a base64 string previously produced with BF, using the same key. |
| SHA1 | [VDS7] Returns a SHA-1 hash of the string (40 hexadecimal characters; not reversible). |
| SHA256 | [VDS7] Returns a SHA-256 hash of the string (64 hexadecimal characters; not reversible). |
| B64 | [VDS7] Encodes the string as base64. |
| B64DEC | [VDS7] Decodes a base64 string. |
Note that MD5 and CRC hashes are not reversible.
[VDS7] The AES and BF modes provide real, reversible, key-based encryption and are the modes to use for genuine secrets. The key (pass phrase) is the third parameter; a wrong key on decryption returns an empty string rather than leaking data. Internally these use CBC mode with PKCS7 padding and a random IV, with the key derived by PBKDF2-HMAC-SHA1 (random salt, 50 000 iterations); the base64 output carries salt | IV | ciphertext, so encrypting the same text twice gives different output, which is expected. The original @ENCRYPT(string) and @ENCRYPT(string,<number>) XOR encryption is retained, unchanged, for compatibility with data encrypted by earlier versions.
OK
Unchanged.
Example
repeat
%A = @input(Enter string to encrypt:)
if @ok()
%E = @encrypt(%A)
%D = @encrypt(%E)
info Orig. string:@tab()%A @cr()Encrypted:@tab()%E@cr()Decrypted:@tab()%D
end
until @not(@ok())
[VDS7] Strong encryption with a key:
REM encrypt to base64
%%c = @encrypt(My secret, AES, MyPassPhrase)
REM decrypt back to the original text
%%t = @encrypt(%%c, AESDEC, MyPassPhrase)