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

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. 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
  3. 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
  4. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! digital marketing course in coimbatore

    ReplyDelete

  5. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    360DigiTMG

    ReplyDelete
  6. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
    360DigiTMG

    ReplyDelete
  7. I am impressed by the information you shared, enjoyed reading waiting for next blog.
    360DigiTMG Data Science Training in Hyderabad

    ReplyDelete
  8. Truly, one of the best article I've ever witnessed thanks for sharing.
    Data Analytics Certification

    ReplyDelete
  9. These musings just knocked my socks off. I am happy you have posted this.
    data science course in noida

    ReplyDelete
  10. Mmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. data science course in mysore

    ReplyDelete
  11. It is the perfect time to make some plans for the future and it is the time to be happy. I've read this post and if I could I would like to suggest some interesting things or suggestions. Perhaps you could write the next articles referring to this article. I want to read more things about it!
    business analytics course in hyderabad

    ReplyDelete
  12. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
    data analytics training in hyderabad

    ReplyDelete

Post a Comment