iam trying to implement SHA1 (Secure Hash Algorithm) in java ..and i do face this problem so plz help me on : in thie algorithm i have a message that i want to calculate the hash for ...the message length must be multiple of 512 to deal with it..so i first calculate the message length in bits for example say it was 1850 bit..then i calculated the number of needed padding bits to have the message with the desired length and it was : 170 "0" bit 1 "1" bit how can i pad this bits to my message?? how could i get the 170 "0" bit or 1 "1" bit? then i must convert the length of my messge which as we said above 1850 to 64-bit unsigned integer and also pad it to my message to have finally the desired length..do i have to deal with this numbers in binary or ASCII or how can i do that???plz reply to me very important..
hi Henry thanx a lot...but this is not a homework it self iam working with a project a small part of it is using SHA1 but what u mean it is from the java core package u mean i dont need to implement it does it exist???iam very new to java so i read about shifting and bitwise but plz explain to me more what does this means to me here?plz reply in a clear way..
Take a look at the java.security.MessageDigest class. It will generate you the checksums based on a whole bunch of standards -- and SHA1 is one of the supported standards.
You can probably also google for a quick example on how to use it.