CryptoSys PKI Toolkit Manual

RSA_KeyHashCode

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

VB6/VBA Syntax

Public Declare Function RSA_KeyHashCode Lib "diCrPKI.dll" (ByVal strKey As String) As Long

nRet = RSA_KeyHashCode(strKey)

Parameters

strKey
[in] String containing the RSA private or public key string in internal format.

C/C++ Syntax

long _stdcall RSA_KeyHashCode(const char *szKeyString);

Returns (VB6/C)

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

.NET Equivalent

Rsa.KeyHashCode Method (String)
Rsa.KeyHashCode Method (StringBuilder)

Remarks

Use this function to compare internal key strings. As of version 3.0, internal key strings are encrypted and cannot be compared directly. The actual string values may or may not be the same even though the underlying key is. The hash code value will be the same for a given key. The hash code is computed to an internal algorithm and may return any integer value between -2,147,483,648 and 2,147,483,647 (-231 to 231-1). If the key string is invalid, the return value is zero. Just remember there is approximately a one in 4 billion chance that a valid key string may actually have a hash code of zero, similar to the odds of winning the top prize in a US state lottery, so if you've found one, you've just missed out. [Ver 3.3] The same public or private key string should now return the same hash code value. Earlier versions would have returned a different value for the private and public strings.

Example

See the example in RSA_ReadPrivateKeyInfo.

See Also

RSA_KeyBits RSA_KeyBytes

[Contents] [Index]

[HOME]   [NEXT: RSA_KeyMatch...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.