MessageDigest Applet
M. Gallant 01/15/2003
Computes SHA-1 or MD5 digest values for TextArea contents or selected
file.
- If Unicode is not selected, the entered text is converted to
a byte array, using the default platform encoding (for example Cp1252 == Windows Latin-1 in
USA-English). For file data, the bytes are read exactly as binary data with no character encoding
conversion.
- If Unicode is selected, the entered text is converted to a byte array using
the "UnicodeLittleUnmarked" encoding (commonly used on Win32/Intel) if available.
For file data, the bytes are read directly into a byte array, the byte array is converted to a String with default
encoding, and then the String is converted back into a byte array using the "UnicodeLittleUnmarked" encoding.
[Note: for multiline entered text, the end of line character may be a single LF character in the string]
Based on :
C. Horstmann & G. Cornell Core Java Volume II 3rd Edn. 1998 p. 459
Source code
Further Information
Encoding Types
Hashes and cryptoAPI
Java Cryptography Architecture (JCA) Code Examples & API
Michel I. Gallant
neutron@istar.ca