Contact Us Forum Customers Area

DidiSoft Ltd.

Set hashing

Hashing is used in digital signatures. By default DidiSoft OpenPGP Library for .NET uses SHA1. To set another hashing algorithm to be used for signing data, change the default one through PGPLib.Hash. The possible values are listed in the HashAlgorithm enumeration:

HashAlgorithm.SHA1
HashAlgorithm.SHA256
HashAlgorithm.SHA384
HashAlgorithm.SHA512
HashAlgorithm.SHA224
HashAlgorithm.MD5
HashAlgorithm.MD2
HashAlgorithm.RIPEMD160

The change will have effect on subsequent calls to all SignX and SignAndEncryptX methods of this PGPLib instance. For each new instance it has to be set explicitly again. This example shows how to set the hashing algorithm to SHA 256:

C#

PGPLib pgp = new PGPLib();
pgp.Hash = HashAlgorithm.SHA256;

VB.NET

Dim pgp As New PGPLib()
pgp.Hash = HashAlgorithm.SHA256