JAVA SHA1 and MD5 Implementation with Cryptography Library ( API )

Write a program in C++, C# or Java to implement RSA algorithm using Libraries (API).

SHA1Cryptographic hash functions are widely used for securing communication, storing hash values of passwords in databases, verifying that a message or a file has been transmitted correctly between two entities and others. One of the most widely used algorithms is MD5 (Message Digest Five), which produces a 128-bit hash value, usually expressed as a 32 hex digits number. It is the successor of MD4 and MD2, all of them being developed by Ronald Rivest. Another hash algorithm, also based on MD4, is SHA-1, a cryptographically secure one-way hash algorithm that produces a 160-bit message digest (usually represented as a 40 hex digit number).
Point to be remember before executing the Program
  • Create Text File (.txt) for Message. Eg.: (""H:\\workspace\\ICS\\src\\messageDigest.txt"")
  • Create the Java Class of name : SHA1
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/*
 * author @ Professional Cipher [www.professionalcipher.com] 
 */

public class SHA1 {

 public SHA1(){
  
 }
 
 public static void main(String args[]) throws NoSuchAlgorithmException, FileNotFoundException , IOException{
  
  MessageDigest messageDigest = MessageDigest.getInstance("MD5");
  FileInputStream fileInputStream = new FileInputStream("H:\\workspace\\ICS\\src\\messageDigest.txt");
  
  byte[] bytes = new byte[30];
  int i=0;
  while((i=fileInputStream.read(bytes))!=-1)
  {
   messageDigest.update(bytes , 0 , i);
  }
  
  fileInputStream.close();
  byte[] digest = messageDigest.digest();
  
  FileOutputStream fileOutputStream = new FileOutputStream("H:\\workspace\\ICS\\src\\digest.txt");
  fileOutputStream.write(digest);
  fileOutputStream.close();
  
 }
 
}
For All BE IT Programs : Click Here
JAVA SHA1 and MD5 Implementation with Cryptography Library ( API ) JAVA SHA1 and MD5 Implementation with Cryptography Library ( API ) Reviewed by Huzaif Sayyed on October 18, 2017 Rating: 5

13 comments:

  1. his blog is really useful and it is very interesting thanks for sharing, it is really good and exclusive.
    salesforce Training in Bangalore
    uipath Training in Bangalore
    blueprism Training in Bangalore

    ReplyDelete
  2. Nice blog..! I really loved reading through this article. Thanks for sharing such a amazing post with us and keep blogging...Well written article

    salesforce Training in Bangalore
    uipath Training in Bangalore
    blueprism Training in Bangalore

    ReplyDelete
  3. Great article! It's really a pleasure to visit your site. I've been following your blogs for a while and I'm really impressed by your works. Keep sharing more such blogs.
    aws Training in Bangalore
    python Training in Bangalore
    hadoop Training in Bangalore
    angular js Training in Bangalore
    bigdata analytics Training in Bangalore

    ReplyDelete
  4. Very nice post here and thanks for it .I always like and such a super blog of these post.Excellent and very cool idea and great blog of different kinds of the valuable information's.
    aws Training in Bangalore
    python Training in Bangalore
    hadoop Training in Bangalore
    angular js Training in Bangalore
    bigdata analytics Training in Bangalore

    ReplyDelete
  5. Thanks for sharing your innovative ideas to our vision. your writing style is simply awesome with useful information. Very informative, Excellent work! I will get back here.
    Data Science Course
    Data Science Course in Marathahalli

    ReplyDelete
  6. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Data Science Course

    ReplyDelete

Powered by Blogger.