Sha1 function

From StealthBot Wiki Backup
Revision as of 02:56, 26 December 2009 by Ribose (talk) (Syntax)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Sha1() function is available to StealthBot through the Script Support Class. This function returns a SHA-1 hash of the provided string.

Development

The Sha1 function was added to StealthBot for version 2.7.

Documentation

'// SHA1
'// Returns the result of a standard Sha-1 hash
Public Function Sha1(ByRef Data As String, Optional ByVal inHex As Boolean = False) As String

    Dim a As Long
    Dim B As Long
    Dim c As Long
    Dim d As Long
    Dim e As Long

    Call modSHA1.DefaultSHA1(StrConv(Data, vbFromUnicode), a, B, c, d, e)

    If inHex Then
        Sha1 = LCase(Hex(a) & Hex(B) & Hex(c) & Hex(d) & Hex(e))
    Else
        Sha1 = LongToStr(a) & LongToStr(B) & LongToStr(c) & LongToStr(d) & LongToStr(e)
    End If

End Function

Summary

Returns a standard SHA-1 hash of the specified value.

Syntax

strHash = SHA1(Value, [InHex])

Arguments

  • Data is the value to hash.
  • inHex is an optional Boolean. If True is passed, the result will be a hexadecimal-representation of the hash 40 digits long. If False is passed (default), the result will be a 20-character string (may contain null characters).

Returns

Returns a 20-character string value which is a SHA-1 hash of the specified string. If inHex was True, returns a 40-digit hexadecimal representation of the hash.

Examples

See also