This control will allow you to encrypt/decrypt a string or a file using the Diamond2 cipher.
DIAMOND2 is a cipher designed to exceed DES in strength.
DIAMOND2 uses a variable length key of at least 40 bits. The use of at least a 16 bytes
key is recommended for long term protection of very sensitive data, as a hedge against the
possibility of computing power increasing by several orders of magnitudes in the coming
years.
It is conjectured that DIAMOND2 Lite (Mode 2) and a key length of 16 bytes is at least
equivalent in security to the IDEA cipher, and more secure than the ageing DES algorithm.
The Diamond Encryption Algorithm (the immediate predecessor of DIAMOND2) suffered from a
form of weak keys. It was possible for a key to result in all of the individual 256-byte
substitution arrays to have the same contents if the position of the input key pointer and
the key scheduling CRC value were the same at the start of the second substitution array
as they were at the beginning of the first one. While the probability of this was low (one
in about 240), it is possible that the regular substitution structure that resulted might
have allowed a simplified analytical attack. To correct this, Diamond2 uses the contents
of the substitution array just completed in filling the current substitution array (except
for the first one, of course). This greatly increases the amount of state information in
the tiny pseudorandom number generator used in key scheduling, such that this minor
weakness is eliminated.
History:
Properties:
If the value is >= 0, the .ErrorCode returns the file size of the target file.
If the value is <= 0, the .ErrorCode returns the following code :
Public Enum mcCryptoCode
mc_CRYPTO_KEY_TOO_SMALL = -1
mc_CRYPTO_CANT_INIT_KEY = -2
mc_CRYPTO_CANT_INIT_BUFFER = -11
mc_CRYPTO_CANT_OPEN_FILEIN = -21
mc_CRYPTO_CANT_CREATE_FILEOUT = -22
mc_CRYPTO_ERROR_READING_FILEIN = -31
mc_CRYPTO_ERROR1_WRITING_FILEOUT = -41
mc_CRYPTO_ERROR2_WRITING_FILEOUT = -42
mc_CRYPTO_ERROR1_WRITING_LASTBYTE = -51
mc_CRYPTO_ERROR2_WRITING_LASTBYTE = -52
mc_CRYPTO_BAD_LASTBYTE = -61
End Enum
Public Enum mcMode
FULL_MODE1 = 1 ' more strongest (slowest)
FULL_MODE2 = 3 ' more strong (slow)
LITE_MODE1 = 2 ' strongest (fast)
LITE_MODE2 = 4 ' strong (fastest)
End Enum
Methods:
Events:
VERY IMPORTANT:
The .Key property is case
sensitive.
The length of .Text property can be any size.
The length of .Key property must be greater or equal
to 5 characters (best result with a key of 16 characters or more).
In FULL MODE, the length of the .EncryptedText
property is always a multiple of 16 characters + 1 character.
In LITE MODE, the length of the .EncryptedText
property is always a multiple of 8 characters + 1 character.
© The
MCR Company, 1999. All Rights Reserved.
http://members.xoom.com/mcrcompany/activex