AR Crypto ActiveX Library 1.02

This library includes the RC2 and DES-56 block cipher algorithms, the RC4 stream cipher algorithm, the SHA-1 hash algorithm and other objects that you can use to code or export binary data.

More than a year ago I worked in a project in which I needed strong encryption support, both to store information and to send sensitive data through networks. I didn't find any help by then, and the only few solutions that I found where very expensive, didn't work well or were just not usable from Visual Basic. Today I hope I'm helping other people that might find themselves in a situation like this, so they don't have to spend hours figuring out how to make in Visual Basic all the mathematical operations (many of them with very big numbers for which Visual Basic doesn't have a good support) that these algorithms require.

In the ZIP file you will also find a complete sample application written in Visual Basic. If you have any comments or find a bug, please notify me.

 

Documents used for the implementation of these algorithms:

DES-56 How to implement the Data Encryption Standard (DES), by Matthew Fischer.
RC2 RFC 2268: A Description of the RC2(r) Encryption Algorithm, by Ron Rivest.
RC4 (Sorry; I couldn't find it...)
SHA-1 FIPS 180-1: Secure Hash Standard from the National Institute of Standards and Technology, Computer Security Resource Clearinghouse.
Base64 RFC 2045: Multipurpose Internet Mail Extensions (MIME), Part One: Format of Internet Message Bodies, by Ned Freed and Nathaniel S. Borenstein.

 

For more information:

DES-56
RC2
RC4
SHA-1
General

 

Encryption and hash algorithms objects included in the AR Crypto Library:

DES56 Object RC2 Object
Properties:
  • Key. String that will be used as the key to encrypt and decrypt. The key used in this algorithm is limited to 56 bits, taken out from a 64 bits string. That means that if you specify a password of more than 8 characters, only the first eight will be taken for the password.

Methods:

  • Decrypt (sText As String) As String. This will decrypt the information given in sText.
  • Encrypt (sText As String) As String. This will encrypt the string given in sText.
Properties:
  • EffectiveKeyLength. This unit is in bits. The default is 0, what means that the library will calculate the effective key length based on the length of the password. Anyways, you can set this value to any number between 1 and 1024 if you want to force the algorithm to use any other effective key length.
  • Key. String that will be used as the key to encrypt and decrypt.

Methods:

  • Decrypt (sText As String) As String. This will decrypt the information given in sText.
  • Encrypt (sText As String) As String. This will encrypt the string given in sText.
RC4 Object SHA1 Object
Properties:
  • Key. String that will be used as the key to encrypt and decrypt.

Methods:

  • Decrypt (sText As String) As String. This will decrypt the information given in sText.
  • Encrypt (sText As String) As String. This will encrypt the string given in sText.
Methods:
  • Hash (sText As String) As String. Just put the data in sText and the function will return its message diggest.

 

Coding and export objects included in the AR Crypto Library:

Base64 FileAccess Hexadecimal
Properties:
  • LastError. This property will inform you if some error ocurred when encoding or decoding data. Its possible values are: B64_ERROR_NO_TEXT, B64_ERROR_WRONG_LENGTH or B64_NO_ERROR. If you try to pass not valid data to be decoded, you will receive an error saying the the length of the passed data is wrong, and will receive wrong data as result, if any.

Methods:

  • Encode (sText As String) As String. This method will encode the data passed in sText.
  • Decode (sText As String) As String. This method will decode the data passed in sText.
Methods:
  • Bin2File (sPath As String, sData As String) As Boolean. This will put the contents of sData into the file specified in sPath, overwriting if the file already existed. Returns True if successful.
  • File2Bin(sPath As String) As String. This function will return the contents of the file specified in sPath.
Methods:
  • Bin2Hex (sData As String) As String. This expresion will take binary data and convert it to hexadecimal format.
  • Hex2Bin (sData As String) As String. This method will take binary data in hexadecimal format and convert it to ASCII data.
  • Num2Hex (Num As Double, [Bytes As Long]) As String. You can use this method to convert decimal numbers to hexadecimal format. This method allow numbers much bigger than the Visual Basic Hex command. Use the bytes option if you want the result to be an specified x bytes expression.
  • Hex2Num (sHex As String) As Double. Use this method to convert an hexadecimal expression to a number.

 

History:

 

(42 Kb)

 

Alvaro Redondo, 1998. All Rights Reserved.
http://www.sevillaonline.com/ActiveX/