VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Faster encryption/decryption with CryptoAPI

BarryDunne  (3 Submissions)   Encryption   Visual Basic 3.0   Beginner   Wed 3rd February 2021

This module provides encryption/decryption through the CryptoAPI. This is the standard API you can use regardless of the underlying dll used to do the encryption. These dlls are called Cryptographic Service Providers (CSPs) and you get one as standard from Microsoft called "Microsoft Base Cryptographic Provider v1.0" This module uses the standard CSP, but this can be changed by changing the constant SERVICE_PROVIDER There is additional code in this module to ensure that the encrypted values do not contain CR or LF characters so that the result can be written to a file
This is a faster version of my previous posting which has the CSP connection and release moved into seperate functions which must be called by the user at the start and end of all encryption. This takes the time taken for 200 encryptions down from 1 minute to 1 second.
A word of warning: If you are going to use WritePrivateProfileString to write the encrypted value to an ini file, you must write a vbNullString first to delete the existing entry as it does not clear previous entries when writing binary data. This is a problem if you are overwriting a value with a smaller one.

Rate Faster encryption/decryption with CryptoAPI (5(5 Vote))
Faster encryption/decryption with CryptoAPI.bas

Faster encryption/decryption with CryptoAPI Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters