Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Continue for my problem(plz help me in)

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
no i have implemented it from my own not by using what is available in the JDK ...the problem is as following:
**the input of my program is the message string which i need to calculate the digest for...
**the output of my program is the Digest
now the output(Digest) must be 160 bit(20 characters)the problem is with using files :
i defined two files one to store my input message the other is for holding the output(Digest) and i have problem in both these files:
for the input file which i put in it the message string when i pass this file name to my program to read the message it gives me every time the same digest even if i change the content of this file in other word i changed the message it self...but if i pass to my program the message string it self not the file name which contains the message it gives mr=e the right answer:

System.out.println ("The Program is Reading Your input Message to calculate the Digest");
try{
FileInputStream Message_File=new FileInputStream ("C:/JBuilder4/lib/input.txt");
BufferedReader buff=new BufferedReader(new InputStreamReader(Message_File));

System.out.println("The resulted Digest in base64 form for the Input_Message =" +Base64_SHA1_Encoding("Message_File"));-->it gives here same digest to all strings

the second problem is with the output file:
when i print the result on the screen using JBuilder it gives me the right result which it is digest of 20 characters but when i want wrote it into a file and i opened the file i find only 19 characters not 20 and if my message was long it gives me something like this |||||||
so for example when i print the result i got this digest:
�#?.?�?Y2??Y2?? ?- but when i open the file i see only 19 charactes there is a missing symbol or i see if the message is longno i have implemented it from my own not by using what is available in the JDK ...the problem is as following:
**the input of my program is the message string which i need to calculate the digest for...
**the output of my program is the Digest
now the output(Digest) must be 160 bit(20 characters)the problem is with using files :
i defined two files one to store my input message the other is for holding the output(Digest) and i have problem in both these files:
for the input file which i put in it the message string when i pass this file name to my program to read the message it gives me every time the same digest even if i change the content of this file in other word i changed the message it self...but if i pass to my program the message string it self not the file name which contains the message it gives mr=e the right answer:

System.out.println ("The Program is Reading Your input Message to calculate the Digest");
try{
FileInputStream Message_File=new FileInputStream ("C:/JBuilder4/lib/input.txt");
BufferedReader buff=new BufferedReader(new InputStreamReader(Message_File));

System.out.println("The resulted Digest in base64 form for the Input_Message =" +Base64_SHA1_Encoding("Message_File"));-->it gives here same digest to all strings

the second problem is with the output file:
when i print the result on the screen using JBuilder it gives me the right result which it is digest of 20 characters but when i want wrote it into a file and i opened the file i find only 19 characters not 20 and if my message was long it gives me something like this |||||||
so for example when i print the result i got this digest:
�#?.?�?Y2??Y2?? ?- but when i open the file i see only 19 charactes there is a missing symbol or i see if the message is long ||||||||
so where the problem may be???i need a serious help plz...
--------------------------------------------------------------------------------

so where the problem may be???i need a serious help plz...
--------------------------------------------------------------------------------
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please continue threads under their original topic, instead of starting new ones. Thanks!

(I've added the above information to the original thread.)
[ April 27, 2006: Message edited by: marc weber ]
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
    Bookmark Topic Watch Topic
  • New Topic