Back to product page

Encrypt method


Encrypts the contents of the Blob.

Type

None

Syntax

  • Basic
object.Encrypt Data, OutBlob
The Encrypt(object,Data,OutBlob) syntax has these parts:
objectAn expression evaluating to an object of type wodCrypt.
Data Required. A Blob object. Contains data to be encrypted.
OutBlobRequired. A Blob object. Holds encrypted data.

Remarks

The Encrypt method will encrypt data in a given Blob and store encrypted data in the outgoing Blob. Prior to using it, you must select one of the symmetric algorithms in the Type property. Most commonly you will use the AES algorithm since it is today's standard.

wodCrypt supports optimized and standard encryption. When using wodCrypt in Optimized mode it will prepend internal data to the resulting Blob, containing data size, for example. This is needed because none of the crypto algorithms contain data sizes internally - they only encrypt memory blocks. If you want to share encrypted information to non-wodCrypt libraries, you should NOT use optimized mode. However, in this case, you should always try to provide the input Blob with the proper size (a multiple of the BlockSize property for the selected type).

When you want to decrypt data, you must use exactly the same algorithm and secret key! Different algorithms and/or different secret keys will produce completely different encryption results.

Code sample

  • Basic

Platforms

Windows