Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / December 2004

Tip: Looking for answers? Try searching our database.

MD5 Message Digest question...

Thread view: 
Kian Goh - 03 Dec 2004 17:30 GMT
Hello,

I understand that the MD5 Message Digest algorithm takes as input a message
of arbitrary length and produces as output a 128-bit ``fingerprint'' or
``message digest'' of the input.

The output representation could be:
- A binary digest will be 16 bytes long.
- A hex digest will be 32 characters long.
- A base64 digest will be 22 characters long.

***I choose to use the base64 digest for some reason.***

Note:  According to RFC 2045(page 24), Base64 encoding uses characters A-Z,
a-z, 0-9, +, /, and =.

But one thing I don't understand here. When I printed out the md5 encrypted
message in Base64 format, to my surprise, in addition to the Base64 char, I
also find a "." char.

For example, the md5_encrypted_base64_format = "Dp8.E4JGpg7rKxQa49BF9/"
When looking carefully, there is a "dot" in the 22 char base64 encrypted
string.

Why? Can anyone tell me why? Other than the "dot" char, do I expect more
non-Base64 char?  I need this info to build my regular expression for base64
format.

Thanks,
Kian
Chris - 04 Dec 2004 17:02 GMT
> Hello,
>
[quoted text clipped - 27 lines]
> Thanks,
> Kian

Hi,
OK, first of all, the java.security.MessageDigest class knows
absolutely nothing about "output representation"; it just spits out a
byte[] of length 16. I'm assuming that, since you say the output is
going to be in Base-64, that you're using some other mechanism which
accepts the byte[] with binary data and produces a Base-64 string. I
would say that this encoding method is at fault, since a proper
Base-64 encoder is basically required to accept absolutely any
sequence of bytes and generate a string consisting of the characters
you listed above (the Base-64 alphabet). Since there's a dot coming
out of the encoder, the encoder is faulty (irrelevant of what's going
in), or there's an error somewhere in the process of invoking the
encoder which is making it act somehow "not Base-64". Since I don't
know what encoder you're using, I can't really give any further
details.

Good luck figuring it out,
Chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.