aspose file tools*
The moose likes Beginning Java and the fly likes Continue for my problem(plz help me in) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Continue for my problem(plz help me in)

Mohammad Ahmad
Greenhorn

Joined: Mar 21, 2006
Posts: 18
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...
--------------------------------------------------------------------------------
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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 ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Continue for my problem(plz help me in)