"how numbers are stored and used in computers"
SHA-384 is a variant of the SHA-512 hash function that produces a 384-bit (48-byte) hash value, typically expressed as a 96-character hexadecimal number. It is part of the SHA-2 family and is essentially SHA-512 with a different initialization value and truncated output.
The SHA-384 algorithm processes input data in 1024-bit blocks and produces a 384-bit hash value. The algorithm can be mathematically defined as:
In this definition, the input space
Padding: The input message is padded to ensure its length is congruent to 896 modulo 1024 bits. This padding process involves appending a single '1' bit to the message, followed by enough '0' bits to make the length congruent to 896 modulo 1024. Finally, a 128-bit representation of the original message length is appended to the end.
Initialization: The algorithm initializes eight 64-bit variables (a, b, c, d, e, f, g, h) with specific values. These variables are set to the following hexadecimal values:
Main Loop: The algorithm processes the message in 1024-bit blocks through 80 rounds of operations. These operations utilize bitwise logical functions (Ch, Maj, Σ0, Σ1, σ0, σ1), modular addition, right rotations, and predefined constants (Kt) to transform the input data into the final hash value.
Output: The final hash value is the concatenation of the first six 64-bit variables (a, b, c, d, e, f) after all blocks have been processed, with the last 128 bits truncated. This concatenated value represents the SHA-384 hash of the input message.
SHA-384 offers strong security guarantees due to its design. It provides collision resistance with a complexity of approximately
The time complexity of the SHA-384 algorithm is
SHA-384 is used in various security-critical applications. It is commonly employed in digital signatures, where the goal is to ensure the authenticity and integrity of a document. SHA-384 is also used for file integrity verification, SSL/TLS security, and applications requiring 384-bit hash outputs. It is particularly useful in systems where SHA-512 would be too long but SHA-256 is not secure enough.
For an empty string, the SHA-384 hash value is 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b
. For the string "Hello, World!", the hash value is d33d40f701551f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f
. These examples illustrate the fixed-length output of the SHA-384 algorithm, regardless of the input size.
When implementing SHA-384, it is important to consider the algorithm's similarity to SHA-512, except for initialization values and output truncation. All operations are performed on 64-bit words, and the algorithm uses big-endian byte ordering. The output is typically represented as a 96-character hexadecimal string, which is a common format for displaying hash values. The algorithm is designed to be resistant to length extension attacks, providing an additional layer of security.
Given the strong security guarantees of SHA-384, it is recommended for use in applications requiring a 384-bit hash output. Consider using SHA-384 in combination with HMAC for message authentication to provide additional security. Always use proper salting when hashing passwords to enhance security. Be aware of the algorithm's performance characteristics, and consider the specific security requirements of your application.