In Cryptography, SHA is cryptographic hash function which takes input as 20 Bytes and rendered the hash value in hexadecimal number, 40 digits long approx.
Message Digest Class:
To calculate cryptographic hashing value in Java, MessageDigest Class is used, under the package java.security.
MessagDigest Class provides following cryptographic hash function to find hash value of a text, they are:
This Algorithms are initialized in static method called getInstance(). After selecting the algorithm it calculate the digest value and return the results in byte array.
BigInteger class is used, which converts the resultant byte array into its sign-magnitude representation. This representation is converted into hex format to get the MessageDigest
Input : hello world Output : b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 Input : GeeksForGeeks Output : 112e476505aab51b05aeb2246c02a11df03e1187e886f7c55d4e9935c290ade
HashCode Generated by SHA-256 for: GeeksForGeeks : 112e476505aab51b05aeb2246c02a11df03e1187e886f7c55d4e9935c290ade hello world : b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
- Data Integrity
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- SHA-224 Hash In Java
- MD2 Hash In Java
- SHA-384 Hash In Java
- SHA-512 Hash In Java
- Implementing our Own Hash Table with Separate Chaining in Java
- SHA-1 Hash
- MD5 hash in Python
- Blockchain Hash Function
- Passwords and Cryptographic hash function
- Data Structures | Hash | Question 1
- Data Structures | Hash | Question 2
- Data Structures | Hash | Question 3
- Data Structures | Hash | Question 4
- Data Structures | Hash | Question 5
- Hash Functions in System Security
- Full domain Hashing with variable Hash size in Python
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
- Java.util.concurrent.RecursiveTask class in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : paulsmithkc