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.
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.

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 X Cocoa 32 bit
  • MacOS X Cocoa 64 bit
  • Windows 32 bit
  • Windows 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM