Digest (gb.openssl)

This class wraps the hash algorithms of the OpenSSL project. See Wikipedia: Cryptographic hash function for a start on hash functions.

Diese Klasse ist statisch.

Diese Klasse wirkt wie ein nur lesbar statisches Array.

Statische Eigenschaften
List   Return a list of all supported algorithm names on the current system. The mapping from a name to the actual algorithm is done by OpenSSL internally. The gb.openssl component does not have control over it in any way.

Statische Methoden
IsSupported   Static Function IsSupported ( method As String ) As Boolean

Example

You get the virtual object which represents a specific algorithm by using its name as a key to index the Digest class. From this virtual object, you can hash messages. So, to produce a SHA-256 digest of a string, we would use:

Use "gb.openssl"
Print Base64$(Digest["sha256"]("Gambas Almost Means BASIC!"))
uIcY2lpgsRRkYrY4ETvuAJQmTMrpqV0TckAShNSl+KI=

Keep in mind that the hash functions return raw binary data which can do strange things with your terminal when printed. If you intend to print them, you should use the built-in Base64$ function.