CryptoSys PKI Pro Manual

Rsa.KeyHashCode(StringBuilder) Method

Compute the hash code of an "internal" RSA public or private key string.

Syntax

[C#]
public static int KeyHashCode(
   StringBuilder sbKeyString 
)
[VB]
Public Shared Function KeyHashCode (
   sbKeyString As StringBuilder 
) As Integer

Parameters

sbKeyString  StringBuilder
Internal key string

Return Value

Int32
A 32-bit hash code for the key, or zero on error.

Example

// Use Rsa.KeyHashCode for matching public and private keys
StringBuilder sbPrivateKey = Rsa.ReadPrivateKey("lamps-alice.p8", "");  // Unencrypted .p8 file
StringBuilder sbPublicKey = Rsa.ReadPublicKey("lamps-alice.cer");  // Matching X.509 certificate
Console.WriteLine("Private Key: Rsa.KeyHashCode={0,8:X}", Rsa.KeyHashCode(sbPrivateKey.ToString()));
Console.WriteLine("Public Key:  Rsa.KeyHashCode={0,8:X}", Rsa.KeyHashCode(sbPublicKey.ToString()));
// Private Key: Rsa.KeyHashCode=CA0B84DA
// Public Key:  Rsa.KeyHashCode=CA0B84DA

See Also

VB6/C equivalent: RSA_KeyHashCode

[Contents] [Index]

[PREV: Rsa.KeyHashCode(String) Method...]   [Contents]   [Index]   
   [NEXT: Rsa.KeyMatch(String, String) Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.