e-CryptIt Engine Xojo Plugin

SHA_384 Class (console safe)

SHA_384 is a message digest/hash algorithm with a digest/hash size of 384 bits (48 characters).

This algorithm has been tested against official test vectors.

Object
   SHA_384

class SHA_384 implements

IHashAlgorithm

Methods

FinalUse this function when you are done adding bytes to the SHA_384 class.
shared HashConvenience shared function to hash small data with just one line of code without creating instance of the class.
UpdateUse this method to add data with MemoryBlock to the SHA_384 stream.
UpdateUse this method to add data with String to the SHA_384 stream.

Constants

Version = 16.12

Test case for a known test vector


Dim data as String
Dim hash as SHA_384
Dim result as String
Dim hexResult as String
Dim i as Integer

data = "abc"

// We do this in ASCII because the well known test vectors come in ASCII
data = ConvertEncoding(data,Encodings.ASCII)

hash = new SHA_384()

hash.Update(data)

result = hash.Final()

// Convert to HEX
For i = 1 to 48
    hexResult = hexResult + Right("0"+Hex(Asc(Mid(result,i,1))),2)
next


if hexResult <> Uppercase("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7") then
    return false
end if


// Lets test another official vector

data = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"

// We do this in ASCII because the well known test vectors come in ASCII
data = ConvertEncoding(data,Encodings.ASCII)

hash = new SHA_384()


hash.Update(data)

result = hash.Final()

hexResult = ""
// Convert to HEX
For i = 1 to 48
    hexResult = hexResult + Right("0"+Hex(Asc(Mid(result,i,1))),2)
next


if hexResult = Uppercase("3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b") then
    return true
else
    return false
end if

Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS