Archived Forum Post

Index of archived forum posts

Question:

hash without encoding

Aug 07 '17 at 08:45

I need to do aes-128, cbc..without encoding at each step..i would like to do encoding only at the end..what functions should i use?

current implementation

Required implementation

which functions should i use?


Answer

IV As Variant

The initialization vector to be used with symmetric encryption algorithms (AES, Blowfish, Twofish, etc.). If left unset, no initialization vector is used.

SecretKey As Variant

The binary secret key used for symmetric encryption (Aes, Blowfish, Twofish, ChaCha20, ARC4, 3DES, RC2, etc.). The secret key must be identical for decryption to succeed. The length in bytes of the SecretKey must equal the KeyLength/8.

EncryptString(str As String) As Variant

Encrypts a string and returns the encrypted data as a byte array. The minimal set of properties that should be set before encrypting are: CryptAlgorithm, SecretKey, Charset. Other properties that control encryption are: CipherMode, PaddingScheme, KeyLength, IV. When decrypting, all property settings must match otherwise garbled data is returned. The Charset property controls the exact bytes that get encrypted. Languages such as VB.NET, C#, and Visual Basic work with Unicode strings, thus the input string is Unicode. If Unicode is to be encrypted (i.e. 2 bytes per character) then set the Charset property to "Unicode".

Concat of IV and Encoded bytes should be done with your builtin language functions.

Encode(byteData As Variant, encoding As String) As String

Encode binary data to base64, hex, quoted-printable, or URL-encoding. The encoding can be set to any of the following strings: "base64", "hex", "quoted-printable" (or "qp"), "url", "base32", "Q", "B", "url_rc1738", "url_rfc2396", "url_rfc3986", "url_oauth", "uu", "modBase64", or "html" (for HTML entity encoding).