Class wwEncryption

wwEncryption provides helper functions for two-way string encryption and decryption and one-way string Hash generation.

Two-way encryption is useful for storing things like configuration values that need to be encrypted for storage, but have to be read back later for consumption. Very common for storing configuration values, where the values are significant and contain data needed by the application for later retrieval and usage. Uses TripleDES encryption.

One-way hashes are useful for storing authorization or validation data. The most common scenario for hashes is password encryption where passwords are hashed and stored in a database (or other storage). Hashes are created when a password is initially generated and saved and stored in the hashed format. Any validation of the password then requires that user input is hashed using the same hashing algorithm to verify whether the hash matches to verify validity. Hashes can be computed using various SHA strengths as well as MD5.

Additional functions provide Checksum computation using MD5 and SHA256.

Remarks

Relies uses the .NET Runtime and the wwDotnetBridge library

Class Members

MemberDescription

ComputeHash

o.ComputeHash(lcText, lcAlgorithm, lvHashSalt)

DecryptString

Decrypts a string with a pass phrase using TripleDES encryption. The Decrypt function should use the same encryption key that was used to encrypt the string.

o.DecryptString(lcEncryptedText, lcEncryptionKey)

EncryptString

Encrypts a string with a pass phrase using TripleDES encryption.

o.EncryptString(lcInput, lcEncryptionKey)

GetChecksumFromBytes

Calculates a CheckSum from a binary blob using MD5 or SHA256.

o.GetChecksumFromBytes(lqBytes, lcMode)

GetCheckSumFromFile

Calculates a Checksum from a file using MD5 or SHA256.

o.GetCheckSumFromFile(lcFilename, lcMode)

SetBinHexMode

Creates output for encrypted values in BinHex format instead of the default Base64 format.

o.SetBinHexMode(llBinHex)

SetComputeHashSaltBytes

o.SetComputeHashSaltBytes(lvSalt)

SetEncryptionKey

Sets the default Encryption key for the EncryptString DecryptString methods if the pass phrase is not passed.

Set during application startup which makes the key global for the application.

o.SetEncryptionKey(lcKey)

Requirements

Assembly: wwencryption.prg

See also:

Class wwDotnetBridge

© West Wind Technologies, 2018 • Updated: 09/23/18
Comment or report problem with topic