Net Encryption Library
HashBytesBase64(HashProvider,Byte[],Byte[]) Method
Example 






KellermanSoftware.NetEncryptionLibrary Namespace > Encryption Class > HashBytesBase64 Method : HashBytesBase64(HashProvider,Byte[],Byte[]) Method
The keyed hash algorithm to use
The bytes to hash
The secret key
Return a Base64 encoded one way hash of a series of bytes with a secret key
Syntax
'Declaration
 
Public Overloads Function HashBytesBase64( _
   ByVal hashType As HashProvider, _
   ByVal input() As System.Byte, _
   ByVal key() As System.Byte _
) As System.String
'Usage
 
Dim instance As Encryption
Dim hashType As HashProvider
Dim input() As System.Byte
Dim key() As System.Byte
Dim value As System.String
 
value = instance.HashBytesBase64(hashType, input, key)
public System.string HashBytesBase64( 
   HashProvider hashType,
   System.byte[] input,
   System.byte[] key
)
public function HashBytesBase64( 
    hashType: HashProvider;
    input: System.Bytearray of;
    key: System.Bytearray of
): System.String; 
public function HashBytesBase64( 
   hashType : HashProvider,
   input : System.byte[],
   key : System.byte[]
) : System.String;
public: System.string* HashBytesBase64( 
   HashProvider hashType,
   System.byte[]* input,
   System.byte[]* key
) 
public:
System.String^ HashBytesBase64( 
   HashProvider hashType,
   System.array<byte>^ input,
   System.array<byte>^ key
) 

Parameters

hashType
The keyed hash algorithm to use
input
The bytes to hash
key
The secret key

Return Value

The hashed bytes OR string.empty on error
Example
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
byte[] bytes = new byte[255];
 
for (int i = 0; i < 255; i++)
    bytes[i] = (byte)i;
 
byte[] keyBytes = encryption.EncodingMethod.GetBytes("secret");
            
string results = encryption.HashBytesBase64(HashProvider.SHA512, bytes, keyBytes);
Console.WriteLine(results);
Dim encryption As New Encryption() 'Trial Mode
'Dim encryption As New Encryption("place user name here", "place license key here") 'License Mode
 
Dim bytes(254) As Byte
 
For i As Integer = 0 To 254
    bytes(i) = CByte(i)
Next i
 
Dim keyBytes() As Byte = encryption.EncodingMethod.GetBytes("secret")
            
Dim results As String = encryption.HashBytesBase64(HashProvider.SHA512, bytes, keyBytes)
Console.WriteLine(results)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Encryption Class
Encryption Members
Overload List