SHA384 Hash

Online SHA384 Hash







What is SHA-384?

The SHA-2 family of hash functions is a set of cryptographic hash functions developed by the National Security Agency (NSA) to replace the insecure SHA-1 algorithm. SHA-2 consists of a number of different hash functions that differ in terms of their output size, which ranges from 224 to 512 bits.

One of the member functions of the SHA-2 family is SHA-384, which produces a 384-bit (48-byte) hash value. It is typically represented as a 96-digit hexadecimal number. SHA-384 was designed to be used as a one-way hash function, meaning that it is infeasible to reverse the process and obtain the original input from the hash value.

A hash function is a mathematical algorithm that takes an input (or 'message') and returns a fixed-size string of characters, which is usually a hexadecimal number. The input can be of any size, and the output is always the same size. The output of a hash function is known as a 'hash' or 'digest'.

One of the main uses of hash functions is to verify the integrity of data. For example, when you download a file from the internet, it is often accompanied by a hash value that was calculated by the sender. By calculating the hash of the downloaded file and comparing it to the original hash value, you can ensure that the file was not tampered with or corrupted during the download process.

Another use of hash functions is to create a 'digital fingerprint' of a message. Because it is infeasible to generate two different messages that produce the same hash value, a hash can be used to uniquely identify a specific message. This is often used in digital signatures to verify the authenticity of a message.

SHA-384 is a 'hash-only' function, meaning that it does not use a secret key to calculate the hash value. This means that anyone can calculate the hash of a message and compare it to the original hash value to verify its integrity. However, it also means that it is possible for an attacker to create a different message with the same hash value as the original message. This is known as a 'collision'.

SHA-384 is considered to be more secure than its sister algorithm SHA-256, because it has a larger output size and therefore a higher level of collision resistance. The larger size also makes it more secure for long-term use than the smaller output size of the SHA-256.

SHA-384 is often used in situations where a high level of security is required, such as in financial transactions and government communications. Because of its higher level of security, it is also often used in digital signature schemes and other applications where data integrity is important.

Like other member of the SHA-2 family, it is also widely used to create digital signature in digital certificate. It's also used in digital signature schemes like RSA-SHA384.

It's worth noting that while SHA-384 provides a higher level of security than its sister algorithm SHA-256, it's less efficient in terms of performance and requires more computation power, if you're looking for a balance between security and performance, then you may consider using the SHA-256.



Generate SHA384 In Programming Language?


SHA384 Using MessageDigest Class

                    
public String generateHash(String input) {
    java.security.MessageDigest.MessageDigest md = java.security.MessageDigest.MessageDigest.getInstance("SHA-384");
    md.update(input.getBytes());
    byte[] digest = md.digest();
    return javax.xml.bind.DatatypeConverter.DatatypeConverter.printHexBinary(digest).toUpperCase();
}
                    
                    

SHA384 Using Apache Commons

                    
public String generateHash(String input) {
    return org.apache.commons.codec.digest.DigestUtils.sha384Hex(input);
}
                    
                    

SHA384 Using Guava

                    
public String generateHash(String input) {
    return com.google.common.hash.Hashing.sha384().hashString(input, Charsets.UTF_8).toString();
}
                    
                    

                    
public string GenerateHash(string input)
{
    using (SHA384Managed hasher = new SHA384Managed())
    {
         byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(input);
         byte[] hashBytes = hasher.ComputeHash(inputBytes);

         return Convert.ToHexString(hashBytes);
    }
}
                    
                    

                    
$input = "input";
echo hash('sha384', $input);
                    
                    

Include crypto-js library and the SHA384 plugin

                    
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"
        integrity="sha512-E8QSvWZ0eCLGk4km3hxSsNmGWbLtSCSUcewDQPQWZF6pEU8GlT8a5fF32wOl1i8ftdMhssTrF/OhyGWwonTcXA=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/sha384.min.js"
        integrity="sha512-37ElKz3SQKyT5+6CZWwz37miWTvDMoSFweFYgqJqOw7DYL64Qd9rvtt64v4572f1NMzWJynJMOPJnryf4s3Qgw=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
                    
                    

Generate the SHA384 hash

                    
<script>
   var hash = CryptoJS.SHA384("input").toString();
   alert(hash);
</script>